Thank you for your interest in contributing! This document provides guidelines and instructions for contributing to this project.
- Code of Conduct
- Getting Started
- Development Workflow
- Running Tests
- Code Quality
- Submitting Changes
- Commit Message Guidelines
This project adheres to a code of conduct that all contributors are expected to follow:
- Be respectful and inclusive
- Welcome newcomers and help them learn
- Focus on constructive feedback
- Assume good intentions
- PHP 8.2 or higher
- Composer
- Docker and Docker Compose (for running WireMock)
- Git
-
Fork the repository on GitHub
-
Clone your fork locally:
git clone https://github.com/YOUR-USERNAME/codeception-module-wiremock.git cd codeception-module-wiremock -
Add the upstream repository:
git remote add upstream https://github.com/jasonbenett/codeception-module-wiremock.git
composer installdocker run -d -p 8080:8080 wiremock/wiremock:latestVerify WireMock is running:
curl http://localhost:8080/__admin/health-
Create a feature branch from
main:git checkout -b feature/your-feature-name
-
Make your changes following the coding standards
-
Write or update tests for your changes
-
Run the test suite to ensure everything passes
-
Commit your changes with a clear commit message
-
Push to your fork and create a pull request
Unit tests don't require WireMock to be running:
composer testFunctional tests require WireMock to be running:
docker run -d -p 8080:8080 wiremock/wiremock:latest
composer test:functionalcomposer test && composer test:functionalThis project enforces strict code quality standards. All contributions must pass these checks:
PHPStan runs at max level and must have zero errors:
composer phpstanThe project follows PER Coding Style 3.0:
Check for violations:
composer cs-checkAutomatically fix violations:
composer cs-fixBefore submitting a pull request, ensure all checks pass:
composer phpstan && composer cs-check && composer test && composer test:functional- Update documentation if you've changed functionality
- Add tests for new features or bug fixes
- Ensure all tests pass and code quality checks succeed
- Update CLAUDE.md if you've added new methods or changed architecture
- Create a pull request with a clear description of changes
Your pull request should include:
- Summary: What does this PR do?
- Motivation: Why is this change needed?
- Implementation: How does it work?
- Testing: How did you test this?
- Breaking Changes: Does this break backward compatibility?
## Summary
Add support for delayed responses in stub creation
## Motivation
Users need to simulate slow network responses for testing timeout handling
## Implementation
- Added `haveDelayedStub()` method to Wiremock module
- Implemented `fixedDelayMilliseconds` parameter in WireMock API calls
- Updated request matching to support delay patterns
## Testing
- Added unit tests for delay parameter handling
- Added functional test verifying actual delay behavior
- All existing tests pass
## Breaking Changes
None - this is backward compatibleThis project uses Semantic Commit Messages:
<type>(<scope>): <subject>
<body>
<footer>
feat: New featurefix: Bug fixdocs: Documentation only changesstyle: Code style changes (formatting, missing semi-colons, etc.)refactor: Code change that neither fixes a bug nor adds a featureperf: Performance improvementtest: Adding or updating testschore: Changes to build process or auxiliary tools
# Feature
feat: add support for response delays
# Bug fix
fix: handle null response body in makeAdminRequest
# Documentation
docs: update README with delay examples
# Tests
test: add coverage for edge cases in request matching
# Refactoring
refactor: simplify near-miss formatting logic- Use imperative mood ("add" not "added" or "adds")
- Don't capitalize first letter
- No period at the end of subject
- Keep subject line under 50 characters
- Separate subject from body with blank line
- Wrap body at 72 characters
- Use body to explain what and why, not how
All public methods must have comprehensive PHPDoc:
/**
* Create an HTTP stub for any HTTP method
*
* @param string $method HTTP method (GET, POST, PUT, DELETE, etc.)
* @param string $url URL or URL pattern to match
* @param array<string, mixed> $requestMatchers Additional matching criteria
*
* @return string UUID of created stub mapping
*
* @throws WiremockException If stub creation fails
* @throws JsonException If JSON encoding fails
*/
public function haveHttpStubFor(string $method, string $url, ...): string- Use strict types:
declare(strict_types=1); - Add type hints for all parameters and return types
- Use PHPStan type annotations for arrays
- Validate mixed types before casting
Follow Codeception naming patterns:
have*- Setup/fixture methodssee*/dontSee*- Assertion methodsgrab*- Data retrieval methodssend*- Direct action methods
- Unit tests: Mock external dependencies, test logic in isolation
- Functional tests: Test against real WireMock server
public function testDescriptiveMethodName(FunctionalTester $I): void
{
// Arrange - Set up test data and stubs
$I->haveHttpStubFor('GET', '/api/test', 200, 'response');
// Act - Perform the action
$response = file_get_contents('http://localhost:8080/api/test');
// Assert - Verify the results
$I->assertEquals('response', $response);
$I->seeHttpRequest('GET', '/api/test');
}- All new methods must have tests
- Aim for edge cases, not just happy paths
- Test error conditions and exceptions
- Bugs: Open an issue with reproduction steps
- Features: Open an issue to discuss before implementing
- Questions: Open a discussion on GitHub
By contributing, you agree that your contributions will be licensed under the MIT License.
Contributors will be recognized in:
- GitHub contributors list
- Release notes for significant contributions