From 39c32fdb1b79334f05620470196b8575deb76692 Mon Sep 17 00:00:00 2001 From: Brabli <67018167+Brabli@users.noreply.github.com> Date: Wed, 20 Jul 2022 22:21:00 +0100 Subject: [PATCH] Fix stuff --- config/services.yml | 4 ---- tests/AppKernel.php | 17 ++++++++--------- tests/Service/GeocodeTest.php | 1 + 3 files changed, 9 insertions(+), 13 deletions(-) delete mode 100644 config/services.yml diff --git a/config/services.yml b/config/services.yml deleted file mode 100644 index 8fbf795..0000000 --- a/config/services.yml +++ /dev/null @@ -1,4 +0,0 @@ -services: - Pcm\GeocodeBundle\Service\Geocoder: - autowire: true - public: true \ No newline at end of file diff --git a/tests/AppKernel.php b/tests/AppKernel.php index bc4e526..c9f30d4 100644 --- a/tests/AppKernel.php +++ b/tests/AppKernel.php @@ -7,6 +7,7 @@ namespace Pcm\GeocodeBundle\Tests; use Pcm\GeocodeBundle\PcmGeocodeBundle; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; class AppKernel extends Kernel @@ -16,14 +17,10 @@ class AppKernel extends Kernel */ public function registerBundles(): array { - $bundles = array(); - - if (in_array($this->getEnvironment(), array('test'))) { - $bundles[] = new FrameworkBundle(); - $bundles[] = new PcmGeocodeBundle(); - } - - return $bundles; + return [ + new FrameworkBundle(), + new PcmGeocodeBundle() + ]; } /** @@ -31,6 +28,8 @@ class AppKernel extends Kernel */ public function registerContainerConfiguration(LoaderInterface $loader): void { - $loader->load(__DIR__.'/config_'.$this->getEnvironment().'.yml'); + $loader->load(function (ContainerBuilder $container) { + $container->prependExtensionConfig('framework', ['test' => true]); + }); } } \ No newline at end of file diff --git a/tests/Service/GeocodeTest.php b/tests/Service/GeocodeTest.php index 0758b7b..3c1f169 100644 --- a/tests/Service/GeocodeTest.php +++ b/tests/Service/GeocodeTest.php @@ -10,6 +10,7 @@ use Pcm\GeocodeBundle\Service\Geocoder; use Pcm\GeocodeBundle\Tests\AppKernel; use Pcm\GeocodeBundle\Trait\MappableTrait; use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; +use Symfony\Component\HttpKernel\KernelInterface; class GeocodeTest extends KernelTestCase {