From 3ed7e6a47567843813a55534c9871b22117ed901 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 12 Feb 2010 18:39:10 -0500 Subject: [PATCH] logic bug in build() --- classes/FixtureBuilder.inc | 4 +++- test/FixtureBuilderTest.php | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/classes/FixtureBuilder.inc b/classes/FixtureBuilder.inc index 1bb219a..a7c5653 100644 --- a/classes/FixtureBuilder.inc +++ b/classes/FixtureBuilder.inc @@ -84,7 +84,9 @@ class FixtureBuilder { function build() { if (!empty($this->current_object)) { $this->ensure_type($this->current_object['type']); - return $this->{"build_{$this->current_object['type']}"}($this->current_object); + $result = $this->{"build_{$this->current_object['type']}"}($this->current_object); + unset($this->current_object); + return $result; } } diff --git a/test/FixtureBuilderTest.php b/test/FixtureBuilderTest.php index fd94000..1399461 100644 --- a/test/FixtureBuilderTest.php +++ b/test/FixtureBuilderTest.php @@ -210,6 +210,8 @@ class FixtureBuilderTest extends PHPUnit_Framework_TestCase { break; } } + + $this->assertTrue(!isset($builder->current_object)); } function testBuildEmpty() {