From cfe38985cfa2d2352fb86e649b7094fc0cd145bb Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 6 Nov 2011 09:59:33 -0500 Subject: [PATCH 1/2] Fix failing tests caused by changes in App::objects() --- lib/Cake/Console/Command/CommandListShell.php | 1 + lib/Cake/Console/Command/Task/ExtractTask.php | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Cake/Console/Command/CommandListShell.php b/lib/Cake/Console/Command/CommandListShell.php index 4bf5b9356..67e0005cb 100644 --- a/lib/Cake/Console/Command/CommandListShell.php +++ b/lib/Cake/Console/Command/CommandListShell.php @@ -85,6 +85,7 @@ class CommandListShell extends Shell { $shellList = $this->_appendShells('CORE', $shells, $shellList); $appShells = App::objects('Console/Command', null, false); + $appShells = array_diff($appShells, $shells); $shellList = $this->_appendShells('app', $appShells, $shellList); $plugins = CakePlugin::loaded(); diff --git a/lib/Cake/Console/Command/Task/ExtractTask.php b/lib/Cake/Console/Command/Task/ExtractTask.php index 50c8c94b5..ab5ceaaf9 100644 --- a/lib/Cake/Console/Command/Task/ExtractTask.php +++ b/lib/Cake/Console/Command/Task/ExtractTask.php @@ -353,6 +353,9 @@ class ExtractTask extends Shell { foreach ($models as $model) { App::uses($model, $plugin . 'Model'); $reflection = new ReflectionClass($model); + if (!$reflection->isSubClassOf('Model')) { + continue; + } $properties = $reflection->getDefaultProperties(); $validate = $properties['validate']; if (empty($validate)) { From 3fa0bdb60fe791b9fc766af5bff8838b3cd1eaf1 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sun, 6 Nov 2011 11:24:33 -0500 Subject: [PATCH 2/2] Revert "Fix missing objects in App::objects()" This change caused non controller objects to show in the controller list. Reverting until a better implementation can be done. This reverts commit ba6f3c17fa36f27a36e87fe9dbba84ce9337e516. --- lib/Cake/Core/App.php | 3 --- lib/Cake/Test/Case/Core/AppTest.php | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 7c280488e..c76008ab4 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -422,9 +422,6 @@ class App { if (empty($path)) { $path = self::path($type, $plugin); - if (empty($plugin)) { - $path = array_merge($path, App::core($type)); - } } foreach ((array)$path as $dir) { diff --git a/lib/Cake/Test/Case/Core/AppTest.php b/lib/Cake/Test/Case/Core/AppTest.php index df33f73e2..4c0e9c3ce 100644 --- a/lib/Cake/Test/Case/Core/AppTest.php +++ b/lib/Cake/Test/Case/Core/AppTest.php @@ -278,6 +278,14 @@ class AppTest extends CakeTestCase { $this->assertTrue(in_array('Dispatcher', $result)); $this->assertTrue(in_array('Router', $result)); + App::build(array( + 'Model/Behavior' => App::core('Model/Behavior'), + 'Controller' => App::core('Controller'), + 'Controller/Component' => App::core('Controller/Component'), + 'View' => App::core('View'), + 'Model' => App::core('Model'), + 'View/Helper' => App::core('View/Helper'), + ), App::RESET); $result = App::objects('behavior', null, false); $this->assertTrue(in_array('TreeBehavior', $result)); $result = App::objects('Model/Behavior', null, false);