Download the PHP package jasonbenett/codeception-module-wiremock without Composer
On this page you can find all versions of the php package jasonbenett/codeception-module-wiremock. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jasonbenett/codeception-module-wiremock
More information about jasonbenett/codeception-module-wiremock
Files in jasonbenett/codeception-module-wiremock
Package codeception-module-wiremock
Short Description A Codeception module for WireMock integration.
License MIT
Informations about the package codeception-module-wiremock
Codeception Module WireMock
A Codeception module for WireMock integration, allowing you to mock HTTP services in your functional tests.
Features
- Create HTTP stubs for any HTTP method (GET, POST, PUT, DELETE, etc.)
- Verify that expected HTTP requests were made
- Advanced request matching (body patterns, headers, query parameters)
- Retrieve request data for debugging
- Automatic cleanup between tests
- Near-miss analysis for debugging failed verifications
- Follows Codeception naming conventions
Requirements
- PHP 8.2 or higher
- Codeception 5.3 or higher
- A PSR-18 HTTP Client implementation (e.g., Guzzle, Symfony HttpClient)
- A PSR-17 HTTP Factory implementation (e.g., guzzlehttp/psr7)
- A running WireMock server
Installation
Install via Composer:
This module depends on PSR-18 (HTTP Client) and PSR-17 (HTTP Factories) interfaces. You'll need to install a compatible implementation:
Using Guzzle (recommended):
Using Symfony HttpClient:
Other PSR-18/PSR-17 implementations work as well.
Architecture
This module follows PSR-18 (HTTP Client) and PSR-17 (HTTP Factories) standards, providing true dependency inversion:
- No hard dependency on Guzzle - Use any PSR-compliant HTTP client
- Framework agnostic - Works with Symfony HttpClient, Guzzle, or custom clients
- Optional auto-discovery - Automatically creates Guzzle instances if available
- Full control - Inject your own configured PSR clients for advanced scenarios
This approach allows you to:
- Choose your preferred HTTP client library
- Control HTTP client configuration (timeouts, SSL, proxies, etc.)
- Test with mock PSR-18 clients
- Upgrade HTTP client versions independently
Quick Start
1. Start WireMock Server
Using Docker (recommended):
2. Configure Codeception
Add the WireMock module to your codeception.yml or suite configuration:
3. Write Your First Test
Configuration Options
Basic Configuration (Auto-Discovery)
When using Guzzle, the module can auto-create PSR client instances:
Advanced Configuration (Custom PSR Clients)
For full control and dependency inversion, provide your own PSR-18/PSR-17 implementations:
All Configuration Options
Note: If httpClient, requestFactory, or streamFactory are not provided, the module will attempt to auto-create Guzzle instances if available.
Available Methods
Setup Methods (have*)
haveHttpStubFor
Create an HTTP stub for any HTTP method with advanced request matching.
Examples:
Assertion Methods (see / dontSee)
seeHttpRequest
Verify that an HTTP request was made.
Examples:
dontSeeHttpRequest
Verify that an HTTP request was NOT made.
Example:
seeRequestCount
Assert exact number of requests matching criteria.
Examples:
Data Retrieval Methods (grab*)
grabRequestCount
Get count of requests matching criteria.
Example:
grabAllRequests
Retrieve all recorded requests.
Example:
grabUnmatchedRequests
Get requests that didn't match any stub (returned 404).
Example:
Action Methods (send*)
sendReset
Reset WireMock to default state (preserves file-based stubs if configured).
sendClearRequests
Clear the request journal without affecting stub mappings.
Request Matching Patterns
WireMock supports powerful request matching. Here are common patterns:
URL Matching
Body Matching
Header Matching
Complete Example
Local Development
Using Docker
You can run WireMock using Docker:
Running Tests
Debugging
Near-Miss Analysis
When a verification fails, the module automatically includes near-miss analysis in the error message:
Check Unmatched Requests
View All Requests
Quality Assurance
This project maintains high code quality standards with comprehensive automated checks:
Continuous Integration
Every push and pull request is automatically tested via GitHub Actions across multiple PHP versions:
- ✅ PHP 8.2, 8.3, 8.4 - Full compatibility testing
- ✅ PHPStan Level Max - Zero errors in static analysis
- ✅ PER Coding Style 3.0 - Strict code style compliance
- ✅ Testing - Unit and Functional
- ✅ WireMock Integration Tests - Tests against real WireMock server
Local Development
Run all quality checks before submitting:
Code Quality Metrics
- PHPStan: Max level, zero errors
- Code Coverage: with Codecov reporting
- Code Style: PER Coding Style 3.0 (successor to PSR-12)
- Type Safety: Full PHPDoc annotations with array shapes
- Documentation: Comprehensive inline documentation
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for detailed guidelines including:
- Development workflow and setup
- Code quality standards
- Testing requirements
- Commit message conventions
- Pull request process
License
MIT
Links
- WireMock Documentation
- Codeception Documentation
- GitHub Repository
- Contributing Guidelines
All versions of codeception-module-wiremock with dependencies
ext-json Version *
codeception/codeception Version ^5.3
psr/http-client Version ^1.0
psr/http-factory Version ^1.0
psr/http-message Version ^1.1 || ^2.0