Skip to content

Commit f412009

Browse files
committed
Fix tests
1 parent 1c5f3ca commit f412009

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

tests/Functional/Controller/ImagineControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ protected function setUp(): void
3535
// supported by the current PHP build or not. Enabling WebP in configurations will drop all tests if WebP is
3636
// not supported.
3737
if ($this->webp_generate) {
38-
$filterService = self::getService('liip_imagine.service.filter');
38+
$filterService = self::getService('test.liip_imagine.service.filter');
3939
$webpGenerate = new \ReflectionProperty($filterService, 'webpGenerate');
4040
$webpGenerate->setAccessible(true);
4141
$webpGenerate->setValue($filterService, true);

tests/Functional/app/AppKernel.php

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,25 @@
1111

1212
namespace Liip\ImagineBundle\Tests\Functional\app;
1313

14-
use Symfony\Component\Config\Loader\LoaderInterface;
14+
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
15+
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
1516
use Symfony\Component\HttpKernel\Kernel;
17+
use Symfony\Component\Routing\Loader\Configurator\RouteConfigurator;
18+
use Symfony\Component\Routing\RouteCollectionBuilder;
1619

1720
class AppKernel extends Kernel
1821
{
22+
use MicroKernelTrait;
23+
24+
private bool $enableWebp;
25+
26+
public function __construct(string $environment, bool $debug, bool $enableWebp = false)
27+
{
28+
parent::__construct($environment, $debug);
29+
30+
$this->enableWebp = $enableWebp;
31+
}
32+
1933
public function registerBundles(): iterable
2034
{
2135
$bundles = [
@@ -44,15 +58,23 @@ public function getProjectDir(): string
4458
}
4559

4660
/**
47-
* @throws \Exception
61+
* @param RouteCollectionBuilder|RouteConfigurator $routes
4862
*/
49-
public function registerContainerConfiguration(LoaderInterface $loader): void
63+
protected function configureRoutes($routes): void
64+
{
65+
$routes->import($this->getProjectDir().'/config/routing.yml');
66+
}
67+
68+
protected function configureContainer(ContainerConfigurator $container): void
5069
{
5170
if (version_compare(self::VERSION, '5.3', '>=')) {
52-
$loader->load(__DIR__.'/config/symfony_5-3.yaml');
71+
$container->import($this->getProjectDir().'/config/symfony_5-3.yaml');
5372
} else {
54-
$loader->load(__DIR__.'/config/symfony_legacy.yaml');
73+
$container->import($this->getProjectDir().'/config/symfony_legacy.yaml');
5574
}
56-
$loader->load(__DIR__.'/config/config.yml');
75+
76+
$container->import($this->getProjectDir().'/config/config.yml');
77+
78+
$container->services()->alias('test.liip_imagine.service.filter', 'liip_imagine.service.filter')->public();
5779
}
5880
}

tests/Functional/app/config/config.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ framework:
1313
default_locale: "%locale%"
1414
test: ~
1515

16-
router:
17-
resource: "%kernel.project_dir%/config/routing.yml"
18-
1916
liip_imagine:
2017

2118
controller:

0 commit comments

Comments
 (0)