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

Skip to content

Commit b34ae36

Browse files
[FrameworkBundle] Fix deps=low/high tests
1 parent 2b35f38 commit b34ae36

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-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: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,13 @@ 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+
$this->assertFalse(file_exists($ref.'/Resources/translations/'));
202+
$ref = dirname($ref);
203+
}
199204
$this->assertContains(
200-
strtr(dirname(dirname($ref->getFileName())).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
205+
strtr($ref.'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
201206
$files,
202207
'->registerTranslatorConfiguration() finds Security translation resources'
203208
);

0 commit comments

Comments
 (0)