mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Better error message if you have forgotten to set fixture_file
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@61410 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
8f51649160
commit
fb822a0924
@ -70,7 +70,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
* @param $identifier The identifier string, as provided in your fixture file
|
||||
*/
|
||||
protected function idFromFixture($className, $identifier) {
|
||||
return $this->fixture->idFromFixture($className, $identifier);
|
||||
if($this->fixture) return $this->fixture->idFromFixture($className, $identifier);
|
||||
else user_error("You've called \$this->objFromFixture() but you haven't specified static \$fixture_file.\n" .
|
||||
"Ensure that static \"\$fixture_file = 'module/tests/fixturefile.yml';\" is specified in your " .get_class($this). " class.", E_USER_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -78,7 +80,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
* @return A map of fixture-identifier => object-id
|
||||
*/
|
||||
protected function allFixtureIDs($className) {
|
||||
return $this->fixture->allFixtureIDs($className);
|
||||
if($this->fixture) return $this->fixture->allFixtureIDs($className);
|
||||
else user_error("You've called \$this->objFromFixture() but you haven't specified static \$fixture_file.\n" .
|
||||
"Ensure that static \"\$fixture_file = 'module/tests/fixturefile.yml';\" is specified in your " .get_class($this). " class.", E_USER_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -87,7 +91,9 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
|
||||
* @param $identifier The identifier string, as provided in your fixture file
|
||||
*/
|
||||
protected function objFromFixture($className, $identifier) {
|
||||
return $this->fixture->objFromFixture($className, $identifier);
|
||||
if($this->fixture) return $this->fixture->objFromFixture($className, $identifier);
|
||||
else user_error("You've called \$this->objFromFixture() but you haven't specified static \$fixture_file.\n" .
|
||||
"Ensure that static \"\$fixture_file = 'module/tests/fixturefile.yml';\" is specified in your " .get_class($this). " class.", E_USER_WARNING);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user