Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit9c1312e

Browse files
committed
Fix kernel.project_dir extensibility
1 parent1bbc35a commit9c1312e

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
returnarray_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
namespaceSymfony\Component\HttpKernel\Tests;
1313

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

765+
publicfunctiontestProjectDirExtension()
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)

[8]ページ先頭

©2009-2025 Movatter.jp