From 2371ed9f15070c773036d2206b5df7c0823143a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Lorenzo=20Rodri=CC=81guez?= Date: Tue, 22 Feb 2011 23:36:53 -0430 Subject: [PATCH] Reverting change made in model constructor to lazily initialize the modelClass variable, making remaining controller tests pass --- lib/Cake/Controller/Controller.php | 7 +++---- lib/Cake/tests/cases/libs/controller/controller.test.php | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Controller/Controller.php b/lib/Cake/Controller/Controller.php index c34a3bc81e1..3a6f1180e80 100644 --- a/lib/Cake/Controller/Controller.php +++ b/lib/Cake/Controller/Controller.php @@ -317,9 +317,8 @@ public function __construct($request = null) { if ($this->viewPath == null) { $this->viewPath = Inflector::underscore($this->name); } - if (empty($this->uses)) { - $this->modelClass = Inflector::singularize($this->name); - } + + $this->modelClass = Inflector::singularize($this->name); $this->modelKey = Inflector::underscore($this->modelClass); $this->Components = new ComponentCollection(); @@ -336,7 +335,7 @@ public function __construct($request = null) { } /** - * Provides backwards compatbility avoid problems with empty and isset to alias properties. + * Provides backwards compatibility to avoid problems with empty and isset to alias properties. * * @return void */ diff --git a/lib/Cake/tests/cases/libs/controller/controller.test.php b/lib/Cake/tests/cases/libs/controller/controller.test.php index 4e743ef57be..ec7345ca2f8 100644 --- a/lib/Cake/tests/cases/libs/controller/controller.test.php +++ b/lib/Cake/tests/cases/libs/controller/controller.test.php @@ -578,7 +578,7 @@ function testFlash() { $this->assertEqual($result, $expected); App::build(array( - 'views' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views'. DS) + 'View' => array(LIBS . 'tests' . DS . 'test_app' . DS . 'views'. DS) )); $Controller = new Controller($request); $Controller->response = $this->getMock('CakeResponse', array('_sendHeader'));