BUGFIX If fixture file is NULL don't cause the test framework to break down because of it

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@100548 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2010-03-05 08:34:31 +00:00 committed by Sam Minnee
parent dd64c562cb
commit 87c03b4750

View File

@ -121,17 +121,19 @@ class SapphireTest extends PHPUnit_Framework_TestCase {
self::empty_temp_db();
$fixtureFiles = (is_array($fixtureFile)) ? $fixtureFile : array($fixtureFile);
$i = 0;
foreach($fixtureFiles as $fixtureFilePath) {
$fixture = new YamlFixture($fixtureFilePath);
$fixture->saveIntoDatabase();
$this->fixtures[] = $fixture;
// backwards compatibility: Load first fixture into $this->fixture
if($i == 0) $this->fixture = $fixture;
$i++;
if($fixtureFile) {
$fixtureFiles = (is_array($fixtureFile)) ? $fixtureFile : array($fixtureFile);
$i = 0;
foreach($fixtureFiles as $fixtureFilePath) {
$fixture = new YamlFixture($fixtureFilePath);
$fixture->saveIntoDatabase();
$this->fixtures[] = $fixture;
// backwards compatibility: Load first fixture into $this->fixture
if($i == 0) $this->fixture = $fixture;
$i++;
}
}
$this->logInWithPermission("ADMIN");