diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php index 4eb1d3011..e101505d8 100644 --- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php @@ -299,6 +299,17 @@ class ControllerTestCaseTest extends CakeTestCase { $this->assertEquals($expected, $results); } +/** + * Test array URLs with testAction() + * + * @return void + */ + public function testTestActionArrayUrls() { + $Controller = $this->Case->generate('TestsApps'); + $this->Case->testAction(array('controller' => 'tests_apps', 'action' => 'index')); + $this->assertInternalType('array', $this->Case->controller->viewVars); + } + /** * Make sure testAction() can hit plugin controllers. * diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index 8ed11c7da..1edd40fdd 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -210,7 +210,7 @@ abstract class ControllerTestCase extends CakeTestCase { * - `result` Get the return value of the controller action. Useful * for testing requestAction methods. * - * @param string $url The URL to test + * @param string|array $url The URL to test. * @param array $options See options * @return mixed The specified return type. * @triggers ControllerTestCase $Dispatch, array('request' => $request) @@ -224,6 +224,10 @@ abstract class ControllerTestCase extends CakeTestCase { 'return' => 'result' ); + if (is_array($url)) { + $url = Router::url($url); + } + $restore = array('get' => $_GET, 'post' => $_POST); $_SERVER['REQUEST_METHOD'] = strtoupper($options['method']);