Returns the recorded function calls and its arguments.
public getInvocations ( ) : |
||
return | The recorded function arguments. |
/** * Tests spying. * * @param array $expected * @param string $name * @param callable $invocations * * @test * @dataProvider provideTestGetInvocations */ public function testGetInvocations(array $expected, $name, callable $invocations) { $spy = new Spy(__NAMESPACE__, $name); $spy->enable(); call_user_func($invocations); $this->assertEquals($expected, $spy->getInvocations()); }
/** * Test the invocation of a none exception call. * * @test */ public function testNoException() { eval("function testNoException() { }"); $spy = new Spy(__NAMESPACE__, "testNoException"); $spy->enable(); testNoException(); $invocation = $spy->getInvocations()[0]; $this->assertFalse($invocation->isExceptionThrown()); $this->assertNull($invocation->getException()); }