Skip to content
This repository
Browse code

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

Refs #2200
  • Loading branch information...
commit 61d6a720d6e7b761f210fac1186e2fe5891dc625 1 parent 812e449
Mark Story authored November 05, 2011
15  lib/Cake/Test/Case/TestSuite/ControllerTestCaseTest.php
@@ -471,6 +471,7 @@ public function testNoMocking() {
471 471
  * @return void
472 472
  */
473 473
 	public function testNoControllerReuse() {
  474
+		$this->Case->autoMock = true;
474 475
 		$result = $this->Case->testAction('/tests_apps/index', array(
475 476
 			'data' => array('var' => 'first call'),
476 477
 			'method' => 'get',
@@ -496,4 +497,18 @@ public function testNoControllerReuse() {
496 497
 		$this->assertContains('third call', $result);
497 498
 	}
498 499
 
  500
+/**
  501
+ * Test that multiple calls to redirect in the same test method don't cause issues.
  502
+ *
  503
+ * @return void
  504
+ */
  505
+	public function testTestActionWithMultipleRedirect() {
  506
+		$this->Case->autoMock = true;
  507
+		$Controller = $this->Case->generate('TestsApps');
  508
+
  509
+		$options = array('method' => 'get');
  510
+		$this->Case->testAction('/tests_apps/redirect_to', $options);
  511
+		$this->Case->testAction('/tests_apps/redirect_to', $options);
  512
+	}
  513
+
499 514
 }

0 notes on commit 61d6a72

Please sign in to comment.
Something went wrong with that request. Please try again.