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

Symfony2 Mocker Extension Laravel Package

polishsymfonycommunity/symfony2-mocker-extension

Behat extension for Symfony2 that lets you mock services in the dependency injection container during tests. Built on Mockery and SymfonyMockerContainer. Consider it a hack and use sparingly; alternative: TestDoubleBundle.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Improving Test Coverage for Legacy Symfony2 Systems: Accelerates BDD (Behavior-Driven Development) workflows by enabling mocking of Symfony2 DI container services in Behat tests, reducing manual setup time for integration tests.
  • Legacy System Modernization: Justifies short-term use while refactoring older Symfony2 codebases toward more maintainable architectures (e.g., replacing with TestDoubleBundle or redesigning service dependencies).
  • Build vs. Buy: A lightweight, open-source alternative to commercial testing tools for teams already invested in Symfony2/Behat, avoiding vendor lock-in.
  • Use Cases:
    • Testing complex workflows requiring mocked dependencies (e.g., external APIs, databases) in a Symfony2 context.
    • Rapid prototyping of new features where full DI container integration is needed before refactoring.
    • Compliance/regulatory testing where behavior validation is critical but infrastructure is unstable.

When to Consider This Package

  • Adopt When:

    • Your team uses Symfony2 + Behat and needs to mock DI container services for integration tests.
    • You’re working on a legacy system with tight coupling to the container, and refactoring is not an immediate priority.
    • You require a quick solution (even if hacky) to unblock testing efforts while planning long-term architectural improvements.
    • Your project has low technical debt in test infrastructure (e.g., no existing TestDoubleBundle or similar).
  • Look Elsewhere If:

    • You’re using Symfony 3+ or 4/5/6: This package is abandoned (last release 2016) and incompatible with modern Symfony.
    • Your team prioritizes clean architecture: Mocking the container often indicates deeper design flaws (e.g., service locator anti-patterns).
    • You need long-term maintenance: The README explicitly warns against reliance on this package; prefer TestDoubleBundle or redesign.
    • Your tests are unit-focused: This is for integration/BDD scenarios only.
    • You’re evaluating modern alternatives: Consider PHPUnit’s native mocking, PestPHP, or Laravel’s built-in testing tools if migrating away from Symfony2.

How to Pitch It (Stakeholders)

For Executives:

"This package lets our QA team mock Symfony2 services in automated tests faster, reducing manual effort and accelerating feature validation. It’s a short-term fix for legacy systems—like duct tape for a leaky pipe—while we invest in long-term architecture improvements. Low risk (MIT license, open-source), but we’ll phase it out once we modernize the codebase."

For Engineering:

*"The Symfony2 Mocker Extension plugs into Behat to mock DI container services, cutting test setup time for integration scenarios. Critical caveats:

  • Not production-grade: The README calls it a ‘hack’—use only for legacy systems or temporary needs.
  • Deprecated: Last updated in 2016; avoid for new projects.
  • Design red flag: Mocking the container often signals poor separation of concerns—pair usage with refactoring efforts. Alternatives: If possible, use TestDoubleBundle or redesign services to avoid container dependencies. Proposal: Approve for [specific legacy project] with a 6-month sunset clause to migrate to modern testing practices."*
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.
nasirkhan/laravel-sharekit
directorytree/privacy-filter-classifier
directorytree/privacy-filter
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi
splash/scopes
splash/toolkit
testo/output-teamcity
testo/bridge-symfony