diff --git a/composer.json b/composer.json index ee85561..f32cec3 100644 --- a/composer.json +++ b/composer.json @@ -47,6 +47,7 @@ "phpspec/phpspec": "^7.3", "phpspec/prophecy-phpunit": "^2.0", "phpunit/phpunit": "^9.6.17", + "polishsymfonycommunity/symfony-mocker-container": "^1.0.7", "psalm/plugin-phpunit": "^0.18.4", "psalm/plugin-symfony": "^5.0", "setono/budbee-bundle": "^1.0", diff --git a/tests/Application/Kernel.php b/tests/Application/Kernel.php index 6b4e8e5..da0de16 100644 --- a/tests/Application/Kernel.php +++ b/tests/Application/Kernel.php @@ -8,6 +8,7 @@ use Symfony\Component\HttpKernel\Bundle\BundleInterface; use Symfony\Component\HttpKernel\Kernel as BaseKernel; use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; +use PSS\SymfonyMockerContainer\DependencyInjection\MockerContainer; final class Kernel extends BaseKernel { @@ -43,6 +44,15 @@ protected function configureRoutes(RoutingConfigurator $routes): void } } + protected function getContainerBaseClass(): string + { + if (str_contains($this->environment, 'test')) { + return MockerContainer::class; + } + + return parent::getContainerBaseClass(); + } + private function loadRoutesConfiguration(RoutingConfigurator $routes, string $confDir): void { $routes->import($confDir . '/{routes}/*' . self::CONFIG_EXTS);