Skip to content

Commit 0a8472a

Browse files
committed
Fixing 5.1 deprecation
1 parent 1c55b32 commit 0a8472a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/IntegrationTest.php

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Symfony\Component\HttpFoundation\Response;
2323
use Symfony\Component\HttpKernel\Kernel;
2424
use Symfony\Component\HttpKernel\Log\Logger;
25+
use Symfony\Component\Routing\Loader\Configurator\RoutingConfigurator;
2526
use Symfony\Component\Routing\RouteCollectionBuilder;
2627
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupCollectionInterface;
2728
use Symfony\WebpackEncoreBundle\Asset\EntrypointLookupInterface;
@@ -177,7 +178,7 @@ public function testAutowireDefaultBuildArgument()
177178
}
178179
}
179180

180-
class WebpackEncoreIntegrationTestKernel extends Kernel
181+
abstract class AbstractWebpackEncoreIntegrationTestKernel extends Kernel
181182
{
182183
use MicroKernelTrait;
183184

@@ -203,11 +204,6 @@ public function registerBundles()
203204
];
204205
}
205206

206-
protected function configureRoutes(RouteCollectionBuilder $routes)
207-
{
208-
$routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo');
209-
}
210-
211207
protected function configureContainer(ContainerBuilder $container, LoaderInterface $loader)
212208
{
213209
$container->loadFromExtension('framework', [
@@ -268,6 +264,22 @@ public function renderFoo()
268264
}
269265
}
270266

267+
if (method_exists(AbstractWebpackEncoreIntegrationTestKernel::class, 'configureRouting')) {
268+
class WebpackEncoreIntegrationTestKernel extends AbstractWebpackEncoreIntegrationTestKernel {
269+
protected function configureRouting(RoutingConfigurator $routes): void
270+
{
271+
$routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo');
272+
}
273+
}
274+
} else {
275+
class WebpackEncoreIntegrationTestKernel extends AbstractWebpackEncoreIntegrationTestKernel {
276+
protected function configureRoutes(RouteCollectionBuilder $routes)
277+
{
278+
$routes->add('/foo', 'kernel:'.(parent::VERSION_ID >= 40100 ? ':' : '').'renderFoo');
279+
}
280+
}
281+
}
282+
271283
class WebpackEncoreCacheWarmerTester
272284
{
273285
private $entrypointCacheWarmer;

0 commit comments

Comments
 (0)