omnipay/dummy
Omnipay Dummy gateway for testing: simulates successful and failed payments without talking to real processors. Useful for local development, demos, and automated tests with predictable request/response behavior, supporting common Omnipay purchase flows.
omnipay/dummy package is a mock driver for the Omnipay payment processing library, designed for testing and development rather than production use. It fits well in architectures requiring:
Omnipay\Common\CreditCard, Omnipay\Common\Message\RequestInterface).omnipay/omnipay), which is a lightweight library (~10MB).omnipay/mock if available).200 OK for successful transactions). Risk: Tests may pass falsely if not explicitly configured to simulate failures (e.g., Omnipay\Tests\TestCase helpers).PayerID field). Requires manual setup for edge cases.Omnipay\Tests\GatewayTestCase)?omnipay/omnipay facade or laravel-omnipay wrapper).composer require omnipay/dummy
$gateway = Omnipay::create('Dummy'); // Replaces 'Stripe', 'PayPal', etc.
$gateway = Omnipay::create('Dummy');
$response = $gateway->purchase([])->send();
$this->assertTrue($response->isSuccessful());
\MockObject or Omnipay’s Omnipay\Tests\TestCase to simulate failures:
$gateway->setTestMode(true); // Some drivers support this
omnipay/omnipay:^3.2, ensure dummy driver is compatible).README section clarifying:
Omnipay\Common\AbstractGateway.| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Dummy driver returns hardcoded success | False positives in tests | Use assertFalse($response->isSuccessful()) for negative tests. |
| Omnipay version mismatch | Integration failures | Pin dummy driver version in composer.json. |
| Missing gateway-specific mocks | Incomplete test coverage | Supplement with real test modes or custom mocks. |
| Team misuses in production | Security/compliance violations | Enforce environment checks (e.g., app()->environment('testing')). |
omnipay/dummy (limited; may need to create internal docs).How can I help you explore Laravel packages today?