polishsymfonycommunity/symfony-mocker-container
Illuminate\Container\Container) and Service Provider architecture, which differs fundamentally from Symfony’s ContainerInterface. The package’s core functionality (mocking services in the DI container) is theoretically useful, but the implementation is tightly coupled to Symfony’s AppKernel and Container classes.Mockery, PHPUnit, Laravel’s HTTP tests, and PestPHP), reducing the need for this package unless testing Symfony-like workflows (e.g., legacy monoliths or hybrid apps).partial mocks, Mockery, or Laravel’s createMock()`) may suffice. However, if the team is migrating from Symfony or needs Symfony-compatible testing, this could bridge the gap—but with trade-offs.MockerContainer into Laravel’s context. Key challenges:
Container does not extend Symfony’s ContainerInterface, so direct replacement is impossible.AppKernel equivalent in Laravel is Kernel (or FoundationApplication), but its getContainerBaseClass() method doesn’t exist.Container or use a decorator pattern, but this introduces complexity and maintenance overhead.Mockery, partial mocks).pest-plugin-laravel for mocking).HttpKernel in Laravel (e.g., via symfony/http-kernel) and mock services there.HttpTests). This could limit use to non-HTTP test scenarios (e.g., CLI commands, Artisan).Mockery, Pest) been explored?TestDoubleBundle (recommended by maintainers) be adapted instead?Illuminate\Container\Container is not compatible with Symfony’s ContainerInterface. Direct integration is not feasible without a proxy layer.HttpKernel (e.g., for legacy code), this package could work in that context, but not globally.Mockery, createMock()).LaravelExtension or BehatSymfonyExtension may offer better alternatives.Mockery, Pest, TestDoubleBundle).MockerContainer for Laravel’s Container.class LaravelMockerContainer extends Illuminate\Container\Container {
public function resolve($id) {
if (in_array($this->environment(), ['testing'])) {
return $this->mockResolve($id); // Custom logic
}
return parent::resolve($id);
}
}
symfony/dependency-injection and symfony/http-kernel.symfony/console or symfony/http-foundation.HttpTests, Mockery).MockerContainer only for legacy modules.Container may struggle to diagnose mocking failures.HttpTests) will fail with this package.AppServiceProvider booting).MockerContainer internals.How can I help you explore Laravel packages today?