From 7ceb0993bf4370e20c626cb6e6acb2512d9c2ae5 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 19 Mar 2016 12:16:21 -0400 Subject: [PATCH] Clear the router state after testAction(). When using array urls, internal state in the Router would cause requests to be incorrectly handled causing multiple testAction calls in a single test to fail. By reloading the router we start off with a clean slate each time. Refs #8480 --- lib/Cake/TestSuite/ControllerTestCase.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index b580921f958..db19192595a 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -278,6 +278,10 @@ protected function _testAction($url, $options = array()) { $Dispatch->testController = $this->controller; $Dispatch->response = $this->getMock('CakeResponse', array('send', '_clearBuffer')); $this->result = $Dispatch->dispatch($request, $Dispatch->response, $params); + + // Clear out any stored requests. + Router::reload(); + $this->controller = $Dispatch->testController; $this->vars = $this->controller->viewVars; $this->contents = $this->controller->response->body();