Class Spy
A spy records the arguments and results of function calls.
If you create a Spy without a mock function, it will use the existing function.
Example:
namespace foo; use phpmock\spy\Spy; function bar($min, $max) { return rand($min, $max) + 3; } $spy = new Spy(__NAMESPACE__, "rand"); $spy->enable(); $result = bar(1, 2); assert ([1, 2] == $spy->getInvocations()[0]->getArguments()); assert ($result == $spy->getInvocations()[0]->getReturn() + 3);
- phpmock\Mock implements phpmock\Deactivatable
- phpmock\spy\Spy
Namespace: phpmock\spy
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at spy/Spy.php
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
Link: Donations
Located at spy/Spy.php
public
|
|
public
|
define(),
disable(),
disableAll(),
enable(),
getName(),
getNamespace()
|