From ad2472aab0be52dacfcd707b99b7b17d658e0aef Mon Sep 17 00:00:00 2001 From: Jose Diaz-Gonzalez Date: Sun, 15 Jan 2012 15:00:30 -0500 Subject: [PATCH] Testcase for Controller::setAction() --- .../Test/Case/Controller/ControllerTest.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Test/Case/Controller/ControllerTest.php b/lib/Cake/Test/Case/Controller/ControllerTest.php index a209e3213..52c0c8e69 100644 --- a/lib/Cake/Test/Case/Controller/ControllerTest.php +++ b/lib/Cake/Test/Case/Controller/ControllerTest.php @@ -273,6 +273,21 @@ class TestController extends ControllerTestAppController { ); } + +/** + * view method + * + * @param mixed $testId + * @param mixed $test2Id + * @return void + */ + public function view($testId, $test2Id) { + $this->data = array( + 'testId' => $testId, + 'test2Id' => $test2Id + ); + } + public function returner() { return 'I am from the controller.'; } @@ -978,9 +993,10 @@ class ControllerTest extends CakeTestCase { $request = new CakeRequest('controller_posts/index'); $TestController = new TestController($request); - $TestController->setAction('index', 1, 2); + $TestController->setAction('view', 1, 2); $expected = array('testId' => 1, 'test2Id' => 2); $this->assertSame($expected, $TestController->request->data); + $this->assertSame('view', $TestController->request->params['action']); $this->assertSame('index', $TestController->view); }