From 53ed23d8b63acebb09e4e733aa054712148f1da8 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 25 May 2010 04:17:21 +0000 Subject: [PATCH] BUGFIX If fixture file is NULL don't cause the test framework to break down because of it (from r100548) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105601 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- dev/SapphireTest.php | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 8b75ea719..8dc5be97d 100755 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -129,17 +129,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");