Skip to content

Commit

Permalink
BUGFIX If fixture file is NULL don't cause the test framework to brea…
Browse files Browse the repository at this point in the history
…k down because of it (from r100548)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105601 467b73ca-7a2a-4603-9d3b-597d59a354a9
  • Loading branch information
chillu committed May 25, 2010
1 parent 94801d7 commit 53ed23d
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions dev/SapphireTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,19 @@ function setUp() {

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");
Expand Down

0 comments on commit 53ed23d

Please sign in to comment.