diff --git a/lib/Cake/Test/TestApp/Controller/Component/AppleComponent.php b/lib/Cake/Test/TestApp/Controller/Component/AppleComponent.php index 5119b16cd31..161c1347158 100644 --- a/lib/Cake/Test/TestApp/Controller/Component/AppleComponent.php +++ b/lib/Cake/Test/TestApp/Controller/Component/AppleComponent.php @@ -20,6 +20,7 @@ use Cake\Controller\Component; use Cake\Controller\Controller; +use Cake\Event\Event; /** * AppleComponent class @@ -45,10 +46,11 @@ class AppleComponent extends Component { /** * startup method * + * @param Event $event * @param mixed $controller * @return void */ - public function startup(Controller $controller) { + public function startup(Event $event, Controller $controller) { $this->testName = $controller->name; } } diff --git a/lib/Cake/Test/TestApp/Controller/Component/BananaComponent.php b/lib/Cake/Test/TestApp/Controller/Component/BananaComponent.php index fd26291c9ad..390f9136fc4 100644 --- a/lib/Cake/Test/TestApp/Controller/Component/BananaComponent.php +++ b/lib/Cake/Test/TestApp/Controller/Component/BananaComponent.php @@ -20,6 +20,7 @@ use Cake\Controller\Component; use Cake\Controller\Controller; +use Cake\Event\Event; /** * BananaComponent class @@ -38,10 +39,11 @@ class BananaComponent extends Component { /** * startup method * + * @param Event $event * @param Controller $controller * @return string */ - public function startup(Controller $controller) { + public function startup(Event $event, Controller $controller) { $controller->bar = 'fail'; } } diff --git a/lib/Cake/Test/TestApp/Controller/Component/OrangeComponent.php b/lib/Cake/Test/TestApp/Controller/Component/OrangeComponent.php index bdc262a4aab..5835e810103 100644 --- a/lib/Cake/Test/TestApp/Controller/Component/OrangeComponent.php +++ b/lib/Cake/Test/TestApp/Controller/Component/OrangeComponent.php @@ -16,6 +16,7 @@ use Cake\Controller\Component; use Cake\Controller\Controller; +use Cake\Event\Event; /** * OrangeComponent class @@ -33,10 +34,11 @@ class OrangeComponent extends Component { /** * initialize method * - * @param mixed $controller + * @param Event $event + * @param Controller $controller * @return void */ - public function initialize(Controller $controller) { + public function initialize(Event $event, Controller $controller) { $this->Controller = $controller; $this->Banana->testField = 'OrangeField'; } @@ -44,10 +46,11 @@ public function initialize(Controller $controller) { /** * startup method * + * @param Event $event * @param Controller $controller * @return string */ - public function startup(Controller $controller) { + public function startup(Event $event, Controller $controller) { $controller->foo = 'pass'; } } diff --git a/lib/Cake/Test/TestCase/Controller/ComponentTest.php b/lib/Cake/Test/TestCase/Controller/ComponentTest.php index 12dbb3be198..2c70e066808 100644 --- a/lib/Cake/Test/TestCase/Controller/ComponentTest.php +++ b/lib/Cake/Test/TestCase/Controller/ComponentTest.php @@ -84,12 +84,18 @@ public function testNestedComponentLoading() { * @return void */ public function testInnerComponentsAreNotEnabled() { - $Collection = new ComponentCollection(); + $mock = $this->getMock('Cake\Event\EventManager'); + $controller = new Controller(); + $controller->setEventManager($mock); + + $mock->expects($this->once()) + ->method('attach') + ->with($this->isInstanceOf('TestApp\Controller\Component\AppleComponent')); + + $Collection = new ComponentCollection($controller); $Apple = $Collection->load('Apple'); $this->assertInstanceOf('TestApp\Controller\Component\OrangeComponent', $Apple->Orange, 'class is wrong'); - $result = $Collection->enabled(); - $this->assertEquals(array('Apple'), $result, 'Too many components enabled.'); } /**