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
[c5ca10ca69] where controller re-use was removed.

Refs #2200
This commit is contained in:
mark_story 2011-11-05 17:27:55 -04:00
parent 812e449680
commit 61d6a720d6

View file

@ -471,6 +471,7 @@ class ControllerTestCaseTest extends CakeTestCase {
* @return void * @return void
*/ */
public function testNoControllerReuse() { public function testNoControllerReuse() {
$this->Case->autoMock = true;
$result = $this->Case->testAction('/tests_apps/index', array( $result = $this->Case->testAction('/tests_apps/index', array(
'data' => array('var' => 'first call'), 'data' => array('var' => 'first call'),
'method' => 'get', 'method' => 'get',
@ -496,4 +497,18 @@ class ControllerTestCaseTest extends CakeTestCase {
$this->assertContains('third call', $result); $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);
}
} }