Examples:
Chain Stubbing
ShortifyPunit::when($mock)->first_method()->second_method(1)->returns(1);
ShortifyPunit::when($mock)->first_method()->second_method(2)->returns(2);
ShortifyPunit::when($mock)->first_method(1)->second_method(1)->returns(3);
ShortifyPunit::when($mock)->first_method(2)->second_method(2)->third_method()->returns(4);
echo $mock->first_method()->second_method(1); // prints '1'
echo $mock->first_method()->second_method(2); // prints '2'
echo $mock->first_method(1)->second_method(1); // prints '3'
echo $mock->first_method(2)->second_method(2)->third_method(); // prints '4'
public static when ( ShortifyPunit\Mock\MockInterface $mock ) : ShortifyPunit\Stub\WhenChainCase | ||
$mock | ShortifyPunit\Mock\MockInterface | |
return | ShortifyPunit\Stub\WhenChainCase |