Class Mock
Mocking framework for built-in PHP functions.
Mocking a build-in PHP function is achieved by using PHP's namespace fallback policy. A mock will provide the namespaced function. I.e. only unqualified functions in a non-global namespace can be mocked.
Example:
namespace foo; use phpmock\Mock; $time = new Mock( __NAMESPACE__, "time", function () { return 3; } ); $time->enable(); assert (3 == time()); $time->disable(); assert (3 != time());
- phpmock\Mock implements phpmock\Deactivatable
Direct known subclasses
phpmock\spy\Spy
Namespace: phpmock
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
See:
Link: Donations
Located at Mock.php
License: WTFPL
Author: Markus Malkusch markus@malkusch.de
See:
phpmock\MockBuilder
Link: Donations
Located at Mock.php
public
|
#
__construct( string $namespace, string $name, callable $function )
Set the namespace, function name and the mock function. |
public
|
|
public
|
|
public static
|
|
public
string
|
|
public
string
|
|
public
|