Browse Source

Inline constructClasses().

Remove the actual method body for constructClasses() as it is no longer
needed. I've left a no-op method to make life easier for people if they
are following 3.0.*-dev. Removing the method now would cause seemingly
random test failures now. Instead I'd prefer to remove these methods
after we've done a release announcing their removal.
mark_story 11 years ago
parent
commit
3f110d095e
2 changed files with 7 additions and 25 deletions
  1. 7 9
      src/Controller/Controller.php
  2. 0 16
      tests/TestCase/Controller/ControllerTest.php

+ 7 - 9
src/Controller/Controller.php

@@ -270,8 +270,11 @@ class Controller implements EventListener {
 		$modelClass = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
 		$this->_setModelClass($modelClass);
 
-		$this->constructClasses();
 		$this->initialize();
+
+		$this->_mergeControllerVars();
+		$this->_loadComponents();
+		$this->eventManager()->attach($this);
 	}
 
 /**
@@ -443,19 +446,14 @@ class Controller implements EventListener {
 	}
 
 /**
- * Loads Model and Component classes.
+ * No-op for backwards compatibility.
  *
- * Using the $components properties, classes are loaded
- * and components have their callbacks attached to the EventManager.
- * It is also at this time that Controller callbacks are bound.
+ * The code that used to live here is now in Controller::__construct().
  *
+ * @deprecated 3.0.0 Will be removed in 3.0.0.
  * @return void
- * @link http://book.cakephp.org/2.0/en/controllers.html#Controller::constructClasses
  */
 	public function constructClasses() {
-		$this->_mergeControllerVars();
-		$this->_loadComponents();
-		$this->eventManager()->attach($this);
 	}
 
 /**

+ 0 - 16
tests/TestCase/Controller/ControllerTest.php

@@ -529,22 +529,6 @@ class ControllerTest extends TestCase {
 	}
 
 /**
- * Ensure that _mergeControllerVars is not being greedy and merging with
- * ControllerTestAppController when you make an instance of Controller
- *
- * @return void
- */
-	public function testMergeVarsNotGreedy() {
-		$request = new Request('controller_posts/index');
-
-		$Controller = new Controller($request);
-		$Controller->components = [];
-		$Controller->constructClasses();
-
-		$this->assertFalse(isset($Controller->Session));
-	}
-
-/**
  * testReferer method
  *
  * @return void