Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2539af6

Browse files
committed
minor #16145 [FrameworkBundle] Fix deps=low/high tests (nicolas-grekas)
This PR was merged into the 2.3 branch. Discussion ---------- [FrameworkBundle] Fix deps=low/high tests | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Commits ------- 26ca3dc [FrameworkBundle] Fix deps=low/high tests
2 parents 4d57d58 + 26ca3dc commit 2539af6

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,29 +543,29 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
543543
if (class_exists('Symfony\Component\Validator\Validator')) {
544544
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
545545

546-
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
546+
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
547547
}
548548
if (class_exists('Symfony\Component\Form\Form')) {
549549
$r = new \ReflectionClass('Symfony\Component\Form\Form');
550550

551-
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
551+
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
552552
}
553553
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
554554
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
555555

556-
if (file_exists(dirname($r->getFilename()).'/../composer.json')) {
556+
if (file_exists(dirname($r->getFileName()).'/../composer.json')) {
557557
// with Symfony 2.4, the Security component was split into several subpackages
558558
// and the translations have been moved to the symfony/security-core package
559-
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
559+
$dirs[] = dirname($r->getFileName()).'/../Resources/translations';
560560
} else {
561561
// in Symfony 2.3, translations are located in the symfony/security package
562-
$dirs[] = dirname($r->getFilename()).'/../../Resources/translations';
562+
$dirs[] = dirname($r->getFileName()).'/../../Resources/translations';
563563
}
564564
}
565565
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
566566
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
567567
$reflection = new \ReflectionClass($class);
568-
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/translations')) {
568+
if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/translations')) {
569569
$dirs[] = $dir;
570570
}
571571
if (is_dir($dir = sprintf($overridePath, $bundle))) {
@@ -645,7 +645,7 @@ private function getValidatorXmlMappingFiles(ContainerBuilder $container)
645645

646646
foreach ($container->getParameter('kernel.bundles') as $bundle) {
647647
$reflection = new \ReflectionClass($bundle);
648-
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
648+
if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.xml')) {
649649
$files[] = realpath($file);
650650
$container->addResource(new FileResource($file));
651651
}
@@ -660,7 +660,7 @@ private function getValidatorYamlMappingFiles(ContainerBuilder $container)
660660

661661
foreach ($container->getParameter('kernel.bundles') as $bundle) {
662662
$reflection = new \ReflectionClass($bundle);
663-
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
663+
if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.yml')) {
664664
$files[] = realpath($file);
665665
$container->addResource(new FileResource($file));
666666
}

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,12 @@ public function testTranslator()
196196
'->registerTranslatorConfiguration() finds Form translation resources'
197197
);
198198
$ref = new \ReflectionClass('Symfony\Component\Security\Core\SecurityContext');
199+
$ref = dirname($ref->getFileName());
200+
if (!file_exists($ref.'/composer.json')) {
201+
$ref = dirname($ref);
202+
}
199203
$this->assertContains(
200-
strtr(dirname(dirname($ref->getFileName())).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
204+
strtr($ref.'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
201205
$files,
202206
'->registerTranslatorConfiguration() finds Security translation resources'
203207
);

src/Symfony/Component/Security/Tests/Core/SecurityContextTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,9 @@ public function testGetSetToken()
8989
$context->setToken($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
9090
$this->assertSame($token, $context->getToken());
9191
}
92+
93+
public function testTranslationsAreNotInCore()
94+
{
95+
$this->assertFalse(file_exists(__DIR__.'/../../Core/Resources/translations/'));
96+
}
9297
}

0 commit comments

Comments
 (0)