pock documentation
pock is an HTTP mocking library for tests that works with PSR-18, HTTPlug, and Symfony HTTP Client. Define the requests your code is expected to send, attach responses or failures, and inject the resulting client into the code under test.
Start here
- Installation and basic usage
- Request matching
- JSON requests and responses
- XML requests and responses
- Compatibility
A mock is consumed once by default. Define several mocks on one builder when a test makes several requests, or use repeat()
and always()
when a mock must remain available.
The API reference contains the complete method-level documentation.