Sort of get config to work

This commit is contained in:
Brabli
2022-08-14 15:16:00 +01:00
parent 03b705cf5f
commit 8149b9494d
11 changed files with 111 additions and 33 deletions

View File

@@ -5,11 +5,10 @@ declare(strict_types=1);
namespace Pcm\IconBundle\Tests;
use Pcm\IconBundle\PcmIconBundle;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\HttpKernel\Kernel;
class AppKernel extends Kernel
class TestKernel extends Kernel
{
/**
* @return array
@@ -17,7 +16,6 @@ class AppKernel extends Kernel
public function registerBundles(): array
{
return [
new FrameworkBundle(),
new PcmIconBundle()
];
}
@@ -27,6 +25,6 @@ class AppKernel extends Kernel
*/
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__.'/services_'.$this->getEnvironment().'.yml');
$loader->load(__DIR__.'/../config/packages/pcm_icon.yaml');
}
}

View File

@@ -4,7 +4,8 @@ declare(strict_types=1);
namespace Pcm\IconBundle\Tests\Twig\Functions;
use Pcm\IconBundle\Tests\AppKernel;
use Pcm\IconBundle\DependencyInjection\PcmIconExtension;
use Pcm\IconBundle\Tests\TestKernel;
use Pcm\IconBundle\Twig\Functions\IconExtension;
use Pcm\IconBundle\Twig\Functions\IconNotFound;
use PHPUnit\Framework\TestCase;
@@ -20,7 +21,7 @@ class IconExtensionTest extends TestCase
protected function setUp(): void
{
$kernel = new AppKernel('test', false);
$kernel = new TestKernel('test', true);
$kernel->boot();
$this->icon = $kernel->getContainer()->get('pcm_icon.icon_extension');
}

View File

@@ -1,13 +0,0 @@
# This config is only here to stop a deprecation notice for Symfony 7
framework:
http_method_override: false
services:
pcm_icon.icon_extension:
alias: Pcm\IconBundle\Twig\Functions\IconExtension
public: true
Pcm\IconBundle\Twig\Functions\IconExtension:
arguments:
$directories:
- '%kernel.project_dir%/tests/icons'