mockarena / mockarena
A function mocking utility for PHP
Installs: 8 832
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- php: >=5.6
Requires (Dev)
- peridot-php/leo: ^1.5
- peridot-php/peridot: ^1.18
- squizlabs/php_codesniffer: ^2.6
README
A function mocking utility for PHP
This library allows for mocking non-existent functions so that they can exist during tests, and their invocation be tracked and evaluated.
Example
$mocker = new \Mockarena\Mockarena(); $fn = $mocker->mock('add_filter'); add_filter('login_url', 'some_func'); assert(count($fn->calls) === 1); assert($fn->calls[0] == ['login_url', 'some_func']); $fn->calledWith(1, 2)->willReturn(300); $result = add_filter(1, 2); assert($result === 300);