From 23c37efc71ad3a869fe4c670add282a03e45618b Mon Sep 17 00:00:00 2001 From: AD7six Date: Fri, 1 Jun 2012 20:38:38 +0200 Subject: [PATCH] Load fixtures from a consistent location If a test is baked for a plugin - it should by default look for fixtures in the same plugin, otherwise it creates potentially complex inter-plugin/app dependencies. --- lib/Cake/Console/Command/Task/TestTask.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/Cake/Console/Command/Task/TestTask.php b/lib/Cake/Console/Command/Task/TestTask.php index f8509f274..b5b6c501b 100644 --- a/lib/Cake/Console/Command/Task/TestTask.php +++ b/lib/Cake/Console/Command/Task/TestTask.php @@ -403,11 +403,10 @@ class TestTask extends BakeTask { * @return void */ protected function _addFixture($name) { - $parent = get_parent_class($name); - $prefix = 'app.'; - if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') { - $pluginName = substr($parent, 0, -8); - $prefix = 'plugin.' . Inflector::underscore($pluginName) . '.'; + if ($this->plugin) { + $prefix = 'plugin.' . Inflector::underscore($this->plugin) . '.'; + } else { + $prefix = 'app.'; } $fixture = $prefix . Inflector::underscore($name); $this->_fixtures[$name] = $fixture;