Skip to content

Commit

Permalink
Inline constructClasses().
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
markstory committed Sep 15, 2014
1 parent 059bdc7 commit 3f110d0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 25 deletions.
16 changes: 7 additions & 9 deletions src/Controller/Controller.php
Expand Up @@ -270,8 +270,11 @@ public function __construct(Request $request = null, Response $response = null,
$modelClass = ($this->plugin ? $this->plugin . '.' : '') . $this->name;
$this->_setModelClass($modelClass);

$this->constructClasses();
$this->initialize();

$this->_mergeControllerVars();
$this->_loadComponents();
$this->eventManager()->attach($this);
}

/**
Expand Down Expand Up @@ -443,19 +446,14 @@ public function implementedEvents() {
}

/**
* 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);
}

/**
Expand Down
16 changes: 0 additions & 16 deletions tests/TestCase/Controller/ControllerTest.php
Expand Up @@ -528,22 +528,6 @@ public function testMergeVars() {
);
}

/**
* 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
*
Expand Down

0 comments on commit 3f110d0

Please sign in to comment.