Create dependencies between tests in PHPUnit

Code
<?php

class DependsTest extends PHPUnit_Framework_TestCase
{
    public function 
testSetValue()
    {
        
$foo = new Foo();
        
        
$this->assertNull($foo->getValue());
        
        
$foo->setValue(4);
        
$this->assertEquals(4$foo->getValue());
        
        
// returned $foo is param of dependent tests 
        
return $foo;
    }
    
    
/**
     * These two tests doesn't really have a dependency
     * but it's only to show how depends annotation works
     *
     * @depends testSetValue
     */
    
public function testAddIntToValue($foo)
    {
        
$this->assertEquals(5$foo->addIntToValue(1));
    }
}

class 
Foo
{
    private 
$value;
    
    public function 
getValue()
    {
        return 
$this->value;
    }
    
    public function 
setValue($value)
    {
        
$this->value $value;
    }
    
    public function 
addIntToValue($int)
    {
        return 
$this->value $int;
    }
}
Result
Time: 176 ms, Memory: 2.00MB

OK (2 tests, 0 assertions)
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6