omnipay/tests
Test suite and shared fixtures for Omnipay payment gateway drivers. Provides reusable tests to validate gateway behavior, request/response handling, and edge cases across adapters, helping maintain compatibility and confidence when developing or updating Omnipay integrations.
Purpose Alignment (Updated):
Key Synergies (Updated):
HttpClient and Illuminate\Support\Facades\Http for testing API interactions.Anti-Patterns (Unchanged):
Dependencies (Updated):
composer require phpunit/phpunit:^9.5.composer require guzzlehttp/guzzle:^7.0 guzzlehttp/psr7:^2.0
omnipay/omnipay:^4.0 (no version change).Key Integrations (Updated):
Http::fake() or Http::assertSent() for testing webhook handlers alongside Omnipay mocks.use Omnipay\Tests\TestGateway;
use Pest\TestCase;
test('subscription cancellation', function () {
$gateway = TestGateway::create('Stripe');
// ... test logic
});
Potential Conflicts (Updated):
HttpClient), ensure compatibility with Psr7 v2.0.getMockBuilder()) may need updates. Laravel’s testing helpers abstract most of these.| Risk Area | Severity | Mitigation (Updated) |
|---|---|---|
| Test Environment Drift | High | Action: Pin PHPUnit/Guzzle versions in composer.json or use Laravel’s phpunit.xml presets. |
| PHPUnit 10 Migration | Medium | Action: Run phpunit --version to check compatibility. Use Laravel’s built-in PHPUnit config. |
| Guzzle/Psr7 v2.0+ | Low | Action: Laravel 10+ handles this automatically. Legacy projects need explicit version pinning. |
| Mock vs. Real Behavior | Medium | Action: Validate critical paths (e.g., webhooks) with Laravel’s Http::fake(). |
| Deprecation Risk | Low | Action: Monitor Omnipay’s upgrade guide. |
Stack Alignment:
HttpClient) that might conflict with Guzzle v2.0+?Testing Strategy:
Http::fake()) alongside Omnipay mocks? Example:
use Illuminate\Support\Facades\Http;
Http::fake([
'api.stripe.com/*' => Http::response([], 200),
]);
CI/CD Impact:
- uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
coverage: none
tools: phpunit:10
--parallel with unique mock instances per worker to avoid conflicts.Team Readiness:
#test)?Alternatives (Unchanged):
Laravel 10+ Ecosystem:
Http::fake() for webhook or API response simulation.Legacy Laravel (9.x) Considerations:
Anti-Fit (Unchanged):
Assessment Phase (1–2 days):
php -r "echo PHPUnit\Runner\Version::ID;"
composer show guzzlehttp/guzzle
Pilot Integration (1–2 weeks):
composer require phpunit/phpunit:^10.0 guzzlehttp/guzzle:^7.0
TestGateway and Laravel’s Http::fake() for webhooks.use Omnipay\Tests\TestGateway;
use Illuminate\Support\Facades\Http;
test('stripe webhook + refund', function () {
Http::fake([
'api.stripe.com/v1/refunds' => Http::response(['id' => 'ref_123'], 200),
]);
$gateway = TestGateway::create('Stripe');
// ... test refund logic
});
Full Adoption (2–4 weeks):
Omnipay\Tests\GatewayTestCase and add Laravel-specific assertions.#test) or data providers for cleaner tests.#[DataProvider('refundScenarios')]
public function test_refunds(array $input, array $expected): void {
// ...
}
CI/CD Integration (1 week):
- run: composer require phpunit/phpunit:^10.0 --dev
- run: vendor/bin/phpunit --parallel
How can I help you explore Laravel packages today?