Skip to content

Commit

Permalink
Fixing 5.1 deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverryan committed Nov 26, 2019
1 parent 1c55b32 commit 0a8472a
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tests/IntegrationTest.php
Expand Up @@ -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;
Expand Down Expand Up @@ -177,7 +178,7 @@ public function testAutowireDefaultBuildArgument()
}
}

class WebpackEncoreIntegrationTestKernel extends Kernel
abstract class AbstractWebpackEncoreIntegrationTestKernel extends Kernel
{
use MicroKernelTrait;

Expand All @@ -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', [
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 0a8472a

Please sign in to comment.