[FrameworkBundle] Register a NullLogger from test kernels

This commit is contained in:
Maxime Steinhausser 2017-09-30 14:58:47 +02:00
parent 09afa64909
commit c109dcd5ae
3 changed files with 16 additions and 0 deletions

View File

@ -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 @@ class TestAppKernel extends Kernel
{
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
}
protected function build(ContainerBuilder $container)
{
$container->register('logger', NullLogger::class);
}
}

View File

@ -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 @@ class AppKernel extends Kernel
$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()));

View File

@ -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 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
{
$c->register('logger', NullLogger::class);
$c->loadFromExtension('framework', array(
'secret' => '$ecret',
));