diff --git a/tests/IntegrationTest.php b/tests/IntegrationTest.php index 7c4ec354..4a28959f 100644 --- a/tests/IntegrationTest.php +++ b/tests/IntegrationTest.php @@ -22,6 +22,7 @@ use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\HttpKernel\Log\Logger; +use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator; use Symfony\Component\Routing\RouteCollectionBuilder; use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollectionInterface; use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface; @@ -177,7 +178,7 @@ public function testAutowireDefaultBuildArgument() } } -class WebpackEncoreIntegrationTestKernel extends Kernel +abstract class AbstractWebpackEncoreIntegrationTestKernel extends Kernel { use MicroKernelTrait; @@ -203,11 +204,6 @@ public function registerBundles() ]; } - protected function configureRoutes(RouteCollectionBuilder $routes) - { - $routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo'); - } - protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader) { $container->loadFromExtension('framework', [ @@ -268,6 +264,22 @@ public function renderFoo() } } +if (method_exists(AbstractWebpackEncoreIntegrationTestKernel::class, 'configureRouting')) { + class WebpackEncoreIntegrationTestKernel extends AbstractWebpackEncoreIntegrationTestKernel { + protected function configureRouting(RoutingConfigurator $routes): void + { + $routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo'); + } + } +} else { + class WebpackEncoreIntegrationTestKernel extends AbstractWebpackEncoreIntegrationTestKernel { + protected function configureRoutes(RouteCollectionBuilder $routes) + { + $routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo'); + } + } +} + class WebpackEncoreCacheWarmerTester { private $entrypointCacheWarmer;