Permalink
Browse files

Testcase for Controller::setAction()

  • Loading branch information...
josegonzalez committed Jan 15, 2012
1 parent 6046b8d commit ad2472aab0be52dacfcd707b99b7b17d658e0aef
Showing with 17 additions and 1 deletion.
  1. +17 −1 lib/Cake/Test/Case/Controller/ControllerTest.php
@@ -273,6 +273,21 @@ public function index($testId, $test2Id) {
);
}
+
+/**
+ * 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 @@ public function testSetAction() {
$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);
}

0 comments on commit ad2472a

Please sign in to comment.