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.
This commit is contained in:
AD7six 2012-06-01 20:38:38 +02:00
parent 5413143178
commit 23c37efc71

View file

@ -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;