Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Dummy Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Purpose Alignment: The 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:
    • Unit/integration testing of payment workflows without external dependencies.
    • Local development of payment-related features (e.g., cart checkout, subscription flows).
    • CI/CD pipelines where real payment gateways are unnecessary or prohibited.
  • Loose Coupling: Since it’s a dummy driver, it doesn’t enforce strict contracts with real payment gateways (e.g., Stripe, PayPal), making it easy to swap for production drivers later.
  • Limitation: Not suitable for mocking gateway-specific behaviors (e.g., 3D Secure flows, refunds with partial captures). Requires complementary tools (e.g., PHPUnit mocks) for advanced scenarios.

Integration Feasibility

  • Omnipay Compatibility: Works seamlessly with any Omnipay-compatible codebase, as it implements the same interface as real drivers (e.g., Omnipay\Common\CreditCard, Omnipay\Common\Message\RequestInterface).
  • PHP Version Support: Last updated in 2018, but Omnipay’s core is backward-compatible with modern PHP (8.0+). Risk: May need minor adjustments if using newer PHP features (e.g., typed properties).
  • Dependency Overhead: Minimal—only requires Omnipay itself (omnipay/omnipay), which is a lightweight library (~10MB).

Technical Risk

  • Deprecation Risk: Omnipay’s active development has slowed; the dummy driver may not receive updates for new Omnipay versions. Mitigation: Fork the repo or use a community-maintained alternative (e.g., omnipay/mock if available).
  • Behavioral Gaps: Dummy responses are hardcoded (e.g., always returns 200 OK for successful transactions). Risk: Tests may pass falsely if not explicitly configured to simulate failures (e.g., Omnipay\Tests\TestCase helpers).
  • No Gateway-Specific Mocks: Cannot replicate gateway quirks (e.g., PayPal’s PayerID field). Requires manual setup for edge cases.

Key Questions

  1. Testing Scope: Will this replace all real gateway tests, or is it only for basic flow validation?
  2. CI/CD Integration: How will test environments handle dynamic responses (e.g., randomizing transaction IDs for idempotency checks)?
  3. Long-Term Maintenance: Is there a plan to fork/update the package if Omnipay evolves?
  4. Team Familiarity: Does the team have experience with Omnipay’s testing patterns (e.g., Omnipay\Tests\GatewayTestCase)?
  5. Production Parity: Are there critical payment features (e.g., webhooks, payouts) that require real gateway interaction?

Integration Approach

Stack Fit

  • Ideal For:
    • Laravel (via omnipay/omnipay facade or laravel-omnipay wrapper).
    • Symfony or other PHP frameworks using Omnipay.
    • Test-driven development (TDD) for payment modules.
  • Anti-Patterns:
    • Production use (violates MIT license’s "not for production" intent).
    • End-to-end testing without supplementing with real gateway mocks (e.g., Stripe’s test mode).

Migration Path

  1. Add Dependency:
    composer require omnipay/dummy
    
  2. Configure Omnipay:
    $gateway = Omnipay::create('Dummy'); // Replaces 'Stripe', 'PayPal', etc.
    
  3. Update Tests:
    • Replace real gateway calls with dummy driver in unit/integration tests.
    • Example:
      $gateway = Omnipay::create('Dummy');
      $response = $gateway->purchase([])->send();
      $this->assertTrue($response->isSuccessful());
      
  4. Mock Complex Scenarios:
    • Use PHPUnit’s \MockObject or Omnipay’s Omnipay\Tests\TestCase to simulate failures:
      $gateway->setTestMode(true); // Some drivers support this
      

Compatibility

  • Omnipay Version: Must match the version used in production (e.g., if using omnipay/omnipay:^3.2, ensure dummy driver is compatible).
  • PHP Extensions: None required (pure PHP).
  • Database/External Services: Zero dependencies—ideal for isolated testing.

Sequencing

  1. Phase 1: Replace real gateway calls in unit tests with the dummy driver.
  2. Phase 2: Implement integration tests for critical flows (e.g., checkout, refunds) using the dummy driver + manual response tweaks.
  3. Phase 3: For gateway-specific behaviors, supplement with:
    • Real gateway test modes (e.g., Stripe test cards).
    • Custom mocks for unsupported features.
  4. Phase 4: Deprecate dummy driver in favor of real test modes in CI/CD.

Operational Impact

Maintenance

  • Low Effort: No runtime dependencies or external services to maintain.
  • Update Strategy:
    • Monitor Omnipay’s releases for breaking changes.
    • Fork the repo if the dummy driver falls behind (MIT license permits this).
  • Documentation: Add a README section clarifying:
    • Limitations (e.g., no fraud detection mocks).
    • How to extend for custom responses.

Support

  • Debugging: Simple to debug—responses are predictable. Useful for:
    • Verifying request/response structures.
    • Catching serialization errors early.
  • Community Support: Limited (27 stars, last release 5 years ago). Relies on:
    • Omnipay’s community.
    • GitHub issues for bug reports.
  • Workarounds: For unsupported features, implement custom mock classes extending Omnipay\Common\AbstractGateway.

Scaling

  • Performance: Zero overhead—ideal for local development and CI pipelines.
  • Parallel Testing: Can run in isolation without rate limits or external dependencies.
  • Limitations:
    • Cannot simulate gateway rate limits or network latency.
    • No support for webhook testing (requires real gateways or tools like Ngrok).

Failure Modes

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')).

Ramp-Up

  • Onboarding Time: Low (1–2 hours for basic setup).
  • Key Skills Needed:
    • Familiarity with Omnipay’s gateway interface.
    • Basic PHPUnit or PestPHP testing.
  • Training Materials:
    • Omnipay’s official documentation.
    • Example projects using omnipay/dummy (limited; may need to create internal docs).
  • Pitfalls:
    • Assuming the dummy driver replicates all real gateway behaviors.
    • Forgetting to disable it in production (add CI/CD gates to block accidental use).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky