I am using PHPUnit 3.4.9, but I am having some annotation issues @depends. It works, as in the examples, but breaks when the manufacturer imposes on the supplier. I don't know if this is intended to work or not, but my code is basically in the form of:
<?php
class StackTest extends PHPUnit_Framework_TestCase
{
public function testEmpty ($data)
{
$stack = array();
$this->assertTrue(empty($stack));
return $stack;
}
public function testPush (array $stack)
{
array_push($stack, 'foo');
$this->assertEquals('foo', $stack[count($stack)-1]);
$this->assertFalse(empty($stack));
return $stack;
}
public function testPop (array $stack)
{
$this->assertEquals('foo', array_pop($stack));
$this->assertTrue(empty($stack));
}
public function provider ()
{
return array(
);
}
}
The code above is just an example, but shows what my code structure looks like. When he ran, he skipped consumer tests, acting as if the manufacturer had failed. I expect that for each set of testing data in the provider, the manufacturer will work with this data, and all its consumers will work accordingly.
source
share