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() {