Fixture Reuse in PHPUnit 3.4
As mentioned earlier, PHPUnit 3.4 adds support for Test Dependencies as introduced by Kuhn et. al. in JExample: Exploiting Dependencies Between Tests to Improve Defect Localization.
Today I implemented fixture reuse based on test dependency information:
class StackTest extends PHPUnit_Framework_TestCase
public function testPush()
$stack = array();
* @depends testPush
public function testPop(array $stack)
Just like JExample, PHPUnit 3.4 introduces producer-consumer relationships to unit-testing.
- A producer is a test method that yields its unit under test as return value.
- A consumer is a test method that depends on one or more producers and their return values.
PHPUnit 3.4 skips any test method whose producer has failed and the return value of a producer is injected into its consumers.