MINOR Moving user_error() invocations for missing fixtures from YamlFixture into SapphireTest - we shouldn't error out of a single fixture, as the object in question might be contained in another fixture on the same test

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@81310 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-07-08 02:36:05 +00:00
parent 4c78f0e3e5
commit 6c505e5ede
2 changed files with 16 additions and 11 deletions

View File

@ -99,12 +99,7 @@ class YamlFixture extends Object {
if(isset($this->fixtureDictionary[$className][$identifier])) {
return $this->fixtureDictionary[$className][$identifier];
} else {
user_error(sprintf(
"Couldn't find object #%d (%s) in file %s",
$identifier,
$className,
$this->fixtureFile
), E_USER_ERROR);
return false;
}
}
@ -118,11 +113,7 @@ class YamlFixture extends Object {
if(isset($this->fixtureDictionary[$className])) {
return $this->fixtureDictionary[$className];
} else {
user_error(sprintf(
"Couldn't find objects of type %s in file %s",
$className,
$this->fixtureFile
), E_USER_ERROR);
return false;
}
}

View File

@ -122,6 +122,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
if($match) return $match;
}
user_error(sprintf(
"Couldn't find object '%s' (class: %s) in files %s",
$identifier,
$className,
implode(',', Object::get_static(get_class($this), 'fixture_file'))
), E_USER_ERROR);
return false;
}
@ -162,6 +169,13 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
if($match) return $match;
}
user_error(sprintf(
"Couldn't find object '%s' (class: %s) in files %s",
$identifier,
$className,
implode(',', Object::get_static(get_class($this), 'fixture_file'))
), E_USER_ERROR);
return false;
}