From 82d57fb8b2d194b0bfdbbe6ecb7e974615c9cc7b Mon Sep 17 00:00:00 2001 From: mark_story Date: Mon, 20 May 2013 22:22:22 -0400 Subject: [PATCH] Add mocked components to the enable list of components. Mocked components should be enabled so they receive callbacks. This allows more realistic integration tests using testAction(). Stop disabling the constructor as it causes a number of errors with components that use components. Fixes #3842 --- lib/Cake/TestSuite/ControllerTestCase.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Cake/TestSuite/ControllerTestCase.php b/lib/Cake/TestSuite/ControllerTestCase.php index 4037cf378..4e365c6c8 100644 --- a/lib/Cake/TestSuite/ControllerTestCase.php +++ b/lib/Cake/TestSuite/ControllerTestCase.php @@ -363,8 +363,9 @@ abstract class ControllerTestCase extends CakeTestCase { 'class' => $componentClass )); } - $componentObj = $this->getMock($componentClass, $methods, array(), '', false); + $componentObj = $this->getMock($componentClass, $methods, array($controllerObj->Components)); $controllerObj->Components->set($name, $componentObj); + $controllerObj->Components->enable($name); } $controllerObj->constructClasses();