v1.3.0
Add PHPUnit Custom Assertions
Add Custom assertions for PHPUnit if you subclass \Spies\TestCase
: https://github.com/sirbrillig/spies/blob/master/API.md#phpunit-custom-assertions
class MyTest extends \Spies\TestCase {
function test_spy_is_called_correctly() {
$spy = \Spies\make_spy();
$spy( 'hello', 'world', 7 );
$spy( 'hello', 'world', 8 );
$this->assertSpyWasCalledWith( 'hello', 'world', \Spies\any() );
}
}
These can be used in place of Expectations if you want a more pure PHPUnit test experience. You should still call \Spies\finish_spying();
though in your tearDown
method to clear all existing spies and mocks.