From c109dcd5ae0a9c2979bf5ad2957b029f79960b51 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 30 Sep 2017 14:58:47 +0200 Subject: [PATCH] [FrameworkBundle] Register a NullLogger from test kernels --- .../Command/CacheClearCommand/Fixture/TestAppKernel.php | 7 +++++++ .../FrameworkBundle/Tests/Functional/app/AppKernel.php | 7 +++++++ .../FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php index 8a61d96d36c6..18ea12ee30e2 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/Fixture/TestAppKernel.php @@ -11,8 +11,10 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture; +use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\HttpKernel\Kernel; class TestAppKernel extends Kernel @@ -33,4 +35,9 @@ public function registerContainerConfiguration(LoaderInterface $loader) { $loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml'); } + + protected function build(ContainerBuilder $container) + { + $container->register('logger', NullLogger::class); + } } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php index 58fb963855e2..e239bb533169 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Functional/app/AppKernel.php @@ -11,7 +11,9 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app; +use Psr\Log\NullLogger; use Symfony\Component\Config\Loader\LoaderInterface; +use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\HttpKernel\Kernel; @@ -72,6 +74,11 @@ public function registerContainerConfiguration(LoaderInterface $loader) $loader->load($this->rootConfig); } + protected function build(ContainerBuilder $container) + { + $container->register('logger', NullLogger::class); + } + public function serialize() { return serialize(array($this->varDir, $this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug())); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php index f476945f3da0..1994778095d1 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/ConcreteMicroKernel.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Kernel; +use Psr\Log\NullLogger; use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait; use Symfony\Bundle\FrameworkBundle\FrameworkBundle; use Symfony\Component\Config\Loader\LoaderInterface; @@ -77,6 +78,7 @@ protected function configureRoutes(RouteCollectionBuilder $routes) protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader) { + $c->register('logger', NullLogger::class); $c->loadFromExtension('framework', array( 'secret' => '$ecret', ));