...and replay them during future test runs for fast, deterministic, accurate
Disclaimer: Doing this in PHP is not as easy as in programming languages which support monkey patching – this project is not yet fully tested, so please use at your own risk!
Instead of manually mocking external libraries for your tests, record HTTP requests and replay them later.
If you run hundreds of tests, you don't want to hit a real API all the time. This slows down running the tests quite a bit. Not coding all those mocks for API responses speeds up your development process.
One reason for manual mocking is, to get the exact same response every time your app makes a request. Testing against live APIs would require this API to be online all the time.
Send it to your best friends and your grandma. It’ll work on their computers and phones. Send it to your best friends and your grandma. It’ll work on their computers and phones.
This is a fork of the fabulous VCR for ruby library.
Send it to your best friends and your grandma. It’ll work on their computers and phones.
Automatically records and replays your HTTP(s) interactions with minimal setup/configuration code. No modifications to your production code necessary.
Supports common http functions and extensions like streamWrapper (fopen(), fread(), file_get_contents()), SoapClint and cUrl.
Disables all HTTP requests that you don't explicitly allow (except if configured).
Request matching is configurable based on HTTP method, URI, host, path, body and headers, or you can easily implement a custom request matcher to handle any need. The recorded requests and responses are stored on disk in a serialization format of your choice (currently YAML and JSON are built in, and you can easily implement your own custom serializer)
Supports PHPUnit and Behat annotations. Recorded requests and responses can easily be inspected and edited.
Automatically filters confidential or private information like emails, tokens and passwords.
Yes, there is documentation.
d
PHPunit Bootstrap
How to use with Soap Client Example
How to use with Guzzle