Mock core functions and set up expectations similar to Mockery
Mock core functions and set up expectations similar to Mockery.
The uopz extension offers an easy to way mock core functions.
The Mockery library offers a succinct API to declare expectation method calls.
This library combines the two to offer core function mocking with a familiar API.
The recommended method of installing this library is via Composer.
Run the following command from your project root:
$ composer require --dev duncan3dc/uopz-expectations
use duncan3dc\Mock\CoreFunction; CoreFunction::mock("time")->twice()->with()->andReturn(777); time(); # 777 /** * At this point the expectations will be checked, * and an exception will be throw as `time()` * should have been called twice. */ CoreFunction::close();
Read more at http://duncan3dc.github.io/uopz-expectations/
Available as part of the Tidelift Subscription
The maintainers of duncan3dc/uopz-expectations and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.