Browse Source

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.
AD7six 14 years ago
parent
commit
23c37efc71
1 changed files with 4 additions and 5 deletions
  1. 4 5
      lib/Cake/Console/Command/Task/TestTask.php

+ 4 - 5
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;