Another way to share data between tests is to use the @depends
annotation to specify when one test is depending on another. Also, one test can return a value that will be passed as an input parameter to the depending test. Sometimes, this is also called producer test and consumer test. The following code snippet is a simple example:
<?php class DependsTest extends PHPUnit_Framework_TestCase { public function testArrayFill() { $testedArray = array_fill(0,11,1); $this->assertInternalType('array', $testedArray); return $testedArray; } /** * @param array $inputArray * @return array * @depends testArrayFill */ public function testPop(array $inputArray) { array_pop($inputArray); $this->assertEquals(10,count($inputArray)); return $inputArray; } /** * @param array $inputArray * @return array * @depends testPop */ public function testSum(array...