For example, the action in test1 stores data outside *, which test2 then executes the statement, but tearDown deletes this data, thereby violating test2 . Deleting a cache cannot be deleted from tearDown , as other tests depend on it. This question asks if there is a way to skip setUp / tearDown between dependent cases while maintaining @depends functionality (which skips the second test if the first test fails instead of the second test)
public function tearDown() { // delete cache } // verify the expected data was retrieved from an uncached source public function test1() { $sut = new SystemUnderTest(); $data = $sut->getDataAndCache(); $this->assertEquals('expected', $data); return $sut; } // verify the expected data was cached /** @depends test1 */ public function test2($sut) { $this->assertEquals('expected', $sut->getCache()); }
* We will call these integration tests because they interact with an external system.
source share