diff --git a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php index bd95b4db46..73c2a0605c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php +++ b/src/Symfony/Bundle/FrameworkBundle/Kernel/MicroKernelTrait.php @@ -88,6 +88,7 @@ trait MicroKernelTrait { $loader->load(function (ContainerBuilder $container) use ($loader) { $container->loadFromExtension('framework', [ + 'secret' => '%env(APP_SECRET)%', 'router' => [ 'resource' => 'kernel::loadRoutes', 'type' => 'service', @@ -108,7 +109,6 @@ trait MicroKernelTrait $container->addObjectResource($this); $container->fileExists($this->getProjectDir().'/config/bundles.php'); - $container->setParameter('kernel.secret', '%env(APP_SECRET)%'); try { $this->configureContainer($container, $loader); diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php index 3f61496bc2..0addeed984 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Kernel/MicroKernelTraitTest.php @@ -69,4 +69,12 @@ class MicroKernelTraitTest extends TestCase $this->assertEquals('Have a great day!', $response->getContent()); } + + public function testSecretLoadedFromExtension() + { + $kernel = new ConcreteMicroKernel('test', false); + $kernel->boot(); + + self::assertSame('$ecret', $kernel->getContainer()->getParameter('kernel.secret')); + } }