matthiasnoback/symfony-dependency-injection-test
Extension, CompilerPass, and ContainerBuilder APIs, which differ significantly from Laravel’s ServiceProvider/Binding model.$this->app->bind(), $this->app->make(), Mockery/PHPUnit assertions) and third-party packages like orchestra/testbench for testing service providers/containers. This package offers no direct Laravel-specific value unless integrating Symfony DI (e.g., via Symfony’s HttpKernel or FrameworkBundle).ServiceProvider/Binding tests similarly to how it handles Extension/CompilerPass).Illuminate\Container\Container, which lacks Symfony’s Extension/CompilerPass interfaces.assertExtensionConfig(), assertCompilerPass()), requiring custom adapters to map to Laravel’s bind()/tag()/when() methods.singleton() vs. Symfony’s setPublic()).symfony/dependency-injection, symfony/config).refresh() + assertBound()) or Testbench already cover similar ground with lower risk.Mockery or Testbench) transition to this package?Extension/CompilerPass interfaces, which Laravel lacks. Integration would require:
ContainerBuilder alongside Laravel’s container (e.g., for microservices).ServiceProvider/Binding in Symfony-compatible classes (high effort).HttpKernel or FrameworkBundle, this package could test those components directly.SecurityBundle could test its DI config with this package.bind()/tag()/when() to identify overlaps/duplicates.assertTrue($this->app->bound('service')) with assertServiceIsDefined('service') (if adapted).// Laravel test (existing)
public function testLaravelBinding() {
$this->app->bind('service', fn() => new Service());
$this->assertTrue($this->app->bound('service'));
}
// Symfony DI test (new)
public function testSymfonyExtension() {
$extension = new MySymfonyExtension();
$this->assertExtensionConfig($extension, [
'param' => 'value',
]);
}
AbstractExtensionTestCase but using Laravel’s container methods.class LaravelServiceProviderTest extends AbstractExtensionTestCase {
protected function getContainerExtensions(): array {
// Not applicable; would need custom logic to map ServiceProvider to Extension.
return [];
}
protected function assertBindingExists(string $id) {
$this->assertTrue($this->app->bound($id));
}
}
symfony/dependency-injection and symfony/config, which may conflict with Laravel’s autoloader or composer constraints.symfony/dependency-injection may introduce version conflicts with Laravel’s dependencies.Extension, CompilerPass) even for Laravel tests.ServiceProvider would need to understand load() vs. prependExtension().ContainerBuilder).symfony/*) may slow down CI builds or require larger Docker images.| Risk | Impact | Mitigation Strategy |
|---|---|---|
| False Test Results | Symfony assertions misaligned with Laravel behavior. | Write integration tests to validate adapter correctness. |
| Dependency Conflicts | symfony/dependency-injection breaks Laravel’s autoloader. |
Use platform-specific composer.json or Docker isolation. |
| Maintenance Burden | Adapters become outdated. | Assign a tech lead to review adapters post-Laravel/Symfony updates. |
| Poor Developer Experience | Steep learning curve for Laravel devs. |
How can I help you explore Laravel packages today?