Bark if a fixture file is missing

A missing fixture file would previously be silently ignored
This commit is contained in:
AD7six 2012-06-18 15:28:00 +02:00
parent 0df1e90eed
commit a6954a7abc

View file

@ -133,6 +133,7 @@ class CakeFixtureManager {
); );
} }
$loaded = false;
foreach ($fixturePaths as $path) { foreach ($fixturePaths as $path) {
$className = Inflector::camelize($fixture); $className = Inflector::camelize($fixture);
if (is_readable($path . DS . $className . 'Fixture.php')) { if (is_readable($path . DS . $className . 'Fixture.php')) {
@ -141,9 +142,15 @@ class CakeFixtureManager {
$fixtureClass = $className . 'Fixture'; $fixtureClass = $className . 'Fixture';
$this->_loaded[$fixtureIndex] = new $fixtureClass(); $this->_loaded[$fixtureIndex] = new $fixtureClass();
$this->_fixtureMap[$fixtureClass] = $this->_loaded[$fixtureIndex]; $this->_fixtureMap[$fixtureClass] = $this->_loaded[$fixtureIndex];
$loaded = true;
break; break;
} }
} }
if (!$loaded) {
$firstPath = str_replace(array(APP, CAKE_CORE_INCLUDE_PATH, ROOT), '', $fixturePaths[0] . DS . $className . 'Fixture.php');
throw new UnexpectedValueException(__d('cake_dev', 'Referenced fixture class %s (%s) not found', $className, $firstPath));
}
} }
} }