Permalink
Browse files

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
  • Loading branch information...
1 parent 9cdc392 commit 82d57fb8b2d194b0bfdbbe6ecb7e974615c9cc7b @markstory markstory committed May 21, 2013
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Cake/TestSuite/ControllerTestCase.php
@@ -363,8 +363,9 @@ public function generate($controller, $mocks = array()) {
'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();

0 comments on commit 82d57fb

Please sign in to comment.