In some places, my phpunit methods have dependency on two classes so I have decided to write a dedicate method which will create an instance of these two classes(which are related to each other) and will pass them to all phpunit methods. I want to do something like below.
public function testGetInstance()
{
$obj1 = new Class1();
$obj2 = new Class2();
return $obj1, $obj2; //can i use list ?
}
/**
*@depends testGetInstance()
*/
public function testBothFeatures(Class1 $obj1, Class2 $obj2) //how to pass 2 instances?
{
//Do all operation related to $obj1 and $obj2
}
How to achieve above case? Is there a better approach for same?