From 356a0a706b2b8b0e79328e40bf15241de8ca9491 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Mon, 11 Aug 2008 05:16:08 +0000 Subject: [PATCH] BUGFIX: Fixed Yaml fixtures for SapphireTest git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60388 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- core/model/YamlFixture.php | 3 ++- dev/SapphireTest.php | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/core/model/YamlFixture.php b/core/model/YamlFixture.php index fa8f8684e..fee96d583 100644 --- a/core/model/YamlFixture.php +++ b/core/model/YamlFixture.php @@ -112,7 +112,8 @@ class YamlFixture extends Object { * @param $identifier The identifier string, as provided in your fixture file */ public function objFromFixture($className, $identifier) { - return DataObject::get_by_id($className, $this->idFromFixture($className, $identifier)); + $id = $this->idFromFixture($className, $identifier); + if($id) return DataObject::get_by_id($className, $id); } /** diff --git a/dev/SapphireTest.php b/dev/SapphireTest.php index 6c98f3c90..bdbb45115 100644 --- a/dev/SapphireTest.php +++ b/dev/SapphireTest.php @@ -73,7 +73,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { * @param $identifier The identifier string, as provided in your fixture file */ protected function idFromFixture($className, $identifier) { - return $this->fixtureDictionary[$className][$identifier]; + return $this->fixture->idFromFixture($className, $identifier); } /** @@ -81,7 +81,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { * @return A map of fixture-identifier => object-id */ protected function allFixtureIDs($className) { - return $this->fixtureDictionary[$className]; + return $this->fixture->allFixtureIDs($className); } /** @@ -90,7 +90,7 @@ class SapphireTest extends PHPUnit_Framework_TestCase { * @param $identifier The identifier string, as provided in your fixture file */ protected function objFromFixture($className, $identifier) { - return DataObject::get_by_id($className, $this->idFromFixture($className, $identifier)); + return $this->fixture->objFromFixture($className, $identifier); } /**