[FrameworkBundle] Register a NullLogger from test kernels
This commit is contained in:
parent
09afa64909
commit
c109dcd5ae
@ -11,8 +11,10 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Command\CacheClearCommand\Fixture;
|
||||||
|
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
|
||||||
class TestAppKernel extends Kernel
|
class TestAppKernel extends Kernel
|
||||||
@ -33,4 +35,9 @@ class TestAppKernel extends Kernel
|
|||||||
{
|
{
|
||||||
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
|
$loader->load(__DIR__.DIRECTORY_SEPARATOR.'config.yml');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function build(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$container->register('logger', NullLogger::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\app;
|
||||||
|
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||||
use Symfony\Component\Filesystem\Filesystem;
|
use Symfony\Component\Filesystem\Filesystem;
|
||||||
use Symfony\Component\HttpKernel\Kernel;
|
use Symfony\Component\HttpKernel\Kernel;
|
||||||
|
|
||||||
@ -72,6 +74,11 @@ class AppKernel extends Kernel
|
|||||||
$loader->load($this->rootConfig);
|
$loader->load($this->rootConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function build(ContainerBuilder $container)
|
||||||
|
{
|
||||||
|
$container->register('logger', NullLogger::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function serialize()
|
public function serialize()
|
||||||
{
|
{
|
||||||
return serialize(array($this->varDir, $this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug()));
|
return serialize(array($this->varDir, $this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug()));
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\FrameworkBundle\Tests\Kernel;
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Kernel;
|
||||||
|
|
||||||
|
use Psr\Log\NullLogger;
|
||||||
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
use Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait;
|
||||||
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
|
||||||
use Symfony\Component\Config\Loader\LoaderInterface;
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
||||||
@ -77,6 +78,7 @@ class ConcreteMicroKernel extends Kernel implements EventSubscriberInterface
|
|||||||
|
|
||||||
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
|
protected function configureContainer(ContainerBuilder $c, LoaderInterface $loader)
|
||||||
{
|
{
|
||||||
|
$c->register('logger', NullLogger::class);
|
||||||
$c->loadFromExtension('framework', array(
|
$c->loadFromExtension('framework', array(
|
||||||
'secret' => '$ecret',
|
'secret' => '$ecret',
|
||||||
));
|
));
|
||||||
|
Reference in New Issue
Block a user