8000 Fix kernel.project_dir extensibility · symfony/symfony@9c1312e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9c1312e

Browse files
committed
Fix kernel.project_dir extensibility
1 parent 1bbc35a commit 9c1312e

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/Symfony/Component/HttpKernel/Kernel.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ protected function getKernelParameters()
604604
return array_merge(
605605
array(
606606
'kernel.root_dir' => realpath($this->rootDir) ?: $this->rootDir,
607-
'kernel.project_dir' => realpath($this->projectDir) ?: $this->projectDir,
607+
'kernel.project_dir' => realpath($this->getProjectDir()) ?: $this->getProjectDir(),
608608
'kernel.environment' => $this->environment,
609609
'kernel.debug' => $this->debug,
610610
'kernel.name' => $this->name,

src/Symfony/Component/HttpKernel/Tests/KernelTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
namespace Symfony\Component\HttpKernel\Tests;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\Config\Loader\LoaderInterface;
1516
use Symfony\Component\DependencyInjection\ContainerBuilder;
1617
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
1718
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
@@ -761,6 +762,21 @@ public function testSymfonyEnvironmentVariables()
761762
unset($_SERVER['SYMFONY__FOO__BAR']);
762763
}
763764

765+
public function testProjectDirExtension()
766+
{
767+
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer', 'getProjectDir'));
768+
$kernel
769+
->expects($this->atLeastOnce())
770+
->method('getProjectDir')
771+
->willReturn('foo');
772+
$kernel->boot();
773+
774+
$r = new \ReflectionMethod($kernel, 'getKernelParameters');
775+
$r->setAccessible(true);
776+
$kernelParameters = $r->invoke($kernel);
777+
$this->assertSame('foo', $kernelParameters['kernel.project_dir']);
778+
}
779+
764780
/**
765781
* Returns a mock for the BundleInterface.
766782
*

0 commit comments

Comments
 (0)
0