From 61d6a720d6e7b761f210fac1186e2fe5891dc625 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 5 Nov 2011 17:27:55 -0400 Subject: [PATCH] Add test for using autoMock and multiple redirects. Having multiple redirects and not calling generate() before each test, or using autoMock results in an exit. This is related to [c5ca10ca6932b76f505fec39f6e78b34dfcc5b9e] where controller re-use was removed. Refs #2200 --- .../Case/TestSuite/ControllerTestCaseTest.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php index c5007f9ab..2fa946275 100644 --- a/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php +++ b/lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php @@ -471,6 +471,7 @@ class ControllerTestCaseTest extends CakeTestCase { * @return void */ public function testNoControllerReuse() { + $this->Case->autoMock = true; $result = $this->Case->testAction('/tests_apps/index', array( 'data' => array('var' => 'first call'), 'method' => 'get', @@ -496,4 +497,18 @@ class ControllerTestCaseTest extends CakeTestCase { $this->assertContains('third call', $result); } +/** + * Test that multiple calls to redirect in the same test method don't cause issues. + * + * @return void + */ + public function testTestActionWithMultipleRedirect() { + $this->Case->autoMock = true; + $Controller = $this->Case->generate('TestsApps'); + + $options = array('method' => 'get'); + $this->Case->testAction('/tests_apps/redirect_to', $options); + $this->Case->testAction('/tests_apps/redirect_to', $options); + } + }