diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index 9d1acab7775..01bc4193965 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -303,7 +303,7 @@ public function components() { * This method will also set the component to a property. * For example: * - * `$this->addComponent('DebugKit.Toolbar');` + * `$this->addComponent('Acl.Acl');` * * Will result in a `Toolbar` property being set. * diff --git a/src/Controller/ErrorController.php b/src/Controller/ErrorController.php index 657d45a5509..57da6e970f1 100644 --- a/src/Controller/ErrorController.php +++ b/src/Controller/ErrorController.php @@ -31,7 +31,6 @@ class ErrorController extends Controller { */ public function __construct($request = null, $response = null) { parent::__construct($request, $response); - $this->constructClasses(); if (count(Router::extensions()) && !isset($this->RequestHandler) ) { diff --git a/src/Shell/Task/TestTask.php b/src/Shell/Task/TestTask.php index 2339bfba76a..d7b6addf9cb 100644 --- a/src/Shell/Task/TestTask.php +++ b/src/Shell/Task/TestTask.php @@ -363,7 +363,6 @@ protected function _processModel($subject) { * @return void */ protected function _processController($subject) { - $subject->constructClasses(); $models = [$subject->modelClass]; foreach ($models as $model) { list(, $model) = pluginSplit($model); diff --git a/tests/TestCase/Controller/Component/CookieComponentTest.php b/tests/TestCase/Controller/Component/CookieComponentTest.php index c4c2d9bc03a..0ccad53433d 100644 --- a/tests/TestCase/Controller/Component/CookieComponentTest.php +++ b/tests/TestCase/Controller/Component/CookieComponentTest.php @@ -41,8 +41,7 @@ public function setUp() { array('redirect'), array(new Request(), new Response()) ); - $controller->components = array('Cookie'); - $controller->constructClasses(); + $controller->addComponent('Cookie'); $this->Controller = $controller; $this->Cookie = $controller->Cookie; $this->request = $controller->request; diff --git a/tests/TestCase/Controller/Component/RequestHandlerComponentTest.php b/tests/TestCase/Controller/Component/RequestHandlerComponentTest.php index 10217d5659b..5022c6c6287 100644 --- a/tests/TestCase/Controller/Component/RequestHandlerComponentTest.php +++ b/tests/TestCase/Controller/Component/RequestHandlerComponentTest.php @@ -68,7 +68,6 @@ protected function _init() { $request = new Request('controller_posts/index'); $response = $this->getMock('Cake\Network\Response', array('_sendHeader', 'stop')); $this->Controller = new RequestHandlerTestController($request, $response); - $this->Controller->constructClasses(); $this->RequestHandler = new RequestHandlerComponent($this->Controller->components()); Router::scope('/', function($routes) { diff --git a/tests/TestCase/Controller/Component/SecurityComponentTest.php b/tests/TestCase/Controller/Component/SecurityComponentTest.php index 6ab6384bbe9..4806e12e90c 100644 --- a/tests/TestCase/Controller/Component/SecurityComponentTest.php +++ b/tests/TestCase/Controller/Component/SecurityComponentTest.php @@ -141,7 +141,6 @@ public function setUp() { ->will($this->returnValue('/articles/index')); $this->Controller = new SecurityTestController($request); - $this->Controller->constructClasses(); $this->Controller->Security = $this->Controller->TestSecurity; $this->Controller->Security->config('blackHoleCallback', 'fail'); $this->Security = $this->Controller->Security; diff --git a/tests/TestCase/Controller/ComponentTest.php b/tests/TestCase/Controller/ComponentTest.php index c30fc2a8dd2..65743362535 100644 --- a/tests/TestCase/Controller/ComponentTest.php +++ b/tests/TestCase/Controller/ComponentTest.php @@ -112,9 +112,7 @@ public function testMultipleComponentInitialize() { */ public function testSomethingReferencingCookieComponent() { $Controller = new ComponentTestController(); - $Controller->components = array('SomethingWithCookie'); - $Controller->uses = false; - $Controller->constructClasses(); + $Controller->addComponent('SomethingWithCookie'); $Controller->startupProcess(); $this->assertInstanceOf('TestApp\Controller\Component\SomethingWithCookieComponent', $Controller->SomethingWithCookie); diff --git a/tests/TestCase/Controller/ControllerTest.php b/tests/TestCase/Controller/ControllerTest.php index 7954734e7b7..31b1c5cc89e 100644 --- a/tests/TestCase/Controller/ControllerTest.php +++ b/tests/TestCase/Controller/ControllerTest.php @@ -333,9 +333,8 @@ public function testConstructClassesWithComponents() { Plugin::load('TestPlugin'); $Controller = new TestPluginController(new Request(), new Response()); - $Controller->components[] = 'TestPlugin.Other'; + $Controller->addComponent('TestPlugin.Other'); - $Controller->constructClasses(); $this->assertInstanceOf('TestPlugin\Controller\Component\OtherComponent', $Controller->Other); } @@ -507,9 +506,7 @@ public function testRedirectBeforeRedirectListenerReturnFalse() { */ public function testMergeVars() { $request = new Request(); - $TestController = new TestController($request); - $TestController->constructClasses(); $expected = [ 'Html' => null, @@ -524,8 +521,6 @@ public function testMergeVars() { $this->assertEquals($expected, $TestController->components); $TestController = new AnotherTestController($request); - $TestController->constructClasses(); - $this->assertEquals( 'Posts', $TestController->modelClass, @@ -533,22 +528,6 @@ public function testMergeVars() { ); } -/** - * test that options from child classes replace those in the parent classes. - * - * @return void - */ - public function testChildComponentOptionsSupercedeParents() { - $request = new Request('controller_posts/index'); - - $TestController = new TestController($request); - - $expected = array('foo'); - $TestController->components = array('Cookie' => $expected); - $TestController->constructClasses(); - $this->assertEquals($expected, $TestController->components['Cookie']); - } - /** * Ensure that _mergeControllerVars is not being greedy and merging with * ControllerTestAppController when you make an instance of Controller @@ -685,7 +664,6 @@ public function testPaginate() { $Controller = new Controller($request, $response); $Controller->request->query['url'] = []; - $Controller->constructClasses(); $this->assertEquals([], $Controller->paginate); $this->assertNotContains('Paginator', $Controller->helpers); @@ -716,7 +694,6 @@ public function testPaginateUsesModelClass() { $Controller = new Controller($request, $response); $Controller->request->query['url'] = []; - $Controller->constructClasses(); $Controller->modelClass = 'Posts'; $results = $Controller->paginate(); diff --git a/tests/TestCase/Shell/Task/TestTaskTest.php b/tests/TestCase/Shell/Task/TestTaskTest.php index 1c508b5362e..568a064a46e 100644 --- a/tests/TestCase/Shell/Task/TestTaskTest.php +++ b/tests/TestCase/Shell/Task/TestTaskTest.php @@ -389,7 +389,6 @@ public function testBakeControllerTest() { $this->assertNotContains('function setUp()', $result); $this->assertNotContains("\$this->Posts = new PostsController()", $result); - $this->assertNotContains("\$this->Posts->constructClasses()", $result); $this->assertNotContains('function tearDown()', $result); $this->assertNotContains('unset($this->Posts)', $result); @@ -417,7 +416,6 @@ public function testBakePrefixControllerTest() { $this->assertNotContains('function setUp()', $result); $this->assertNotContains("\$this->Posts = new PostsController()", $result); - $this->assertNotContains("\$this->Posts->constructClasses()", $result); $this->assertNotContains('function tearDown()', $result); $this->assertNotContains('unset($this->Posts)', $result); diff --git a/tests/TestCase/View/ViewTest.php b/tests/TestCase/View/ViewTest.php index beca1cf038d..59bddf84e02 100644 --- a/tests/TestCase/View/ViewTest.php +++ b/tests/TestCase/View/ViewTest.php @@ -1115,7 +1115,6 @@ public function testRender() { $this->assertNull($View->render(false, 'ajax2')); $this->PostsController->helpers = array('Session', 'Html'); - $this->PostsController->constructClasses(); $this->PostsController->request->params['action'] = 'index'; Configure::write('Cache.check', true);