[FrameworkBundle] Fix deps=low/high tests
This commit is contained in:
parent
2b35f38d06
commit
26ca3dc6c2
|
@ -543,29 +543,29 @@ class FrameworkExtension extends Extension
|
||||||
if (class_exists('Symfony\Component\Validator\Validator')) {
|
if (class_exists('Symfony\Component\Validator\Validator')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
|
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
|
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
|
||||||
}
|
}
|
||||||
if (class_exists('Symfony\Component\Form\Form')) {
|
if (class_exists('Symfony\Component\Form\Form')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Form\Form');
|
$r = new \ReflectionClass('Symfony\Component\Form\Form');
|
||||||
|
|
||||||
$dirs[] = dirname($r->getFilename()).'/Resources/translations';
|
$dirs[] = dirname($r->getFileName()).'/Resources/translations';
|
||||||
}
|
}
|
||||||
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
|
||||||
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
|
||||||
|
|
||||||
if (file_exists(dirname($r->getFilename()).'/../composer.json')) {
|
if (file_exists(dirname($r->getFileName()).'/../composer.json')) {
|
||||||
// with Symfony 2.4, the Security component was split into several subpackages
|
// with Symfony 2.4, the Security component was split into several subpackages
|
||||||
// and the translations have been moved to the symfony/security-core package
|
// and the translations have been moved to the symfony/security-core package
|
||||||
$dirs[] = dirname($r->getFilename()).'/../Resources/translations';
|
$dirs[] = dirname($r->getFileName()).'/../Resources/translations';
|
||||||
} else {
|
} else {
|
||||||
// in Symfony 2.3, translations are located in the symfony/security package
|
// in Symfony 2.3, translations are located in the symfony/security package
|
||||||
$dirs[] = dirname($r->getFilename()).'/../../Resources/translations';
|
$dirs[] = dirname($r->getFileName()).'/../../Resources/translations';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
|
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
|
||||||
$reflection = new \ReflectionClass($class);
|
$reflection = new \ReflectionClass($class);
|
||||||
if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/translations')) {
|
if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/translations')) {
|
||||||
$dirs[] = $dir;
|
$dirs[] = $dir;
|
||||||
}
|
}
|
||||||
if (is_dir($dir = sprintf($overridePath, $bundle))) {
|
if (is_dir($dir = sprintf($overridePath, $bundle))) {
|
||||||
|
@ -645,7 +645,7 @@ class FrameworkExtension extends Extension
|
||||||
|
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
||||||
$reflection = new \ReflectionClass($bundle);
|
$reflection = new \ReflectionClass($bundle);
|
||||||
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
|
if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.xml')) {
|
||||||
$files[] = realpath($file);
|
$files[] = realpath($file);
|
||||||
$container->addResource(new FileResource($file));
|
$container->addResource(new FileResource($file));
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ class FrameworkExtension extends Extension
|
||||||
|
|
||||||
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
foreach ($container->getParameter('kernel.bundles') as $bundle) {
|
||||||
$reflection = new \ReflectionClass($bundle);
|
$reflection = new \ReflectionClass($bundle);
|
||||||
if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
|
if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.yml')) {
|
||||||
$files[] = realpath($file);
|
$files[] = realpath($file);
|
||||||
$container->addResource(new FileResource($file));
|
$container->addResource(new FileResource($file));
|
||||||
}
|
}
|
||||||
|
|
|
@ -196,8 +196,12 @@ abstract class FrameworkExtensionTest extends TestCase
|
||||||
'->registerTranslatorConfiguration() finds Form translation resources'
|
'->registerTranslatorConfiguration() finds Form translation resources'
|
||||||
);
|
);
|
||||||
$ref = new \ReflectionClass('Symfony\Component\Security\Core\SecurityContext');
|
$ref = new \ReflectionClass('Symfony\Component\Security\Core\SecurityContext');
|
||||||
|
$ref = dirname($ref->getFileName());
|
||||||
|
if (!file_exists($ref.'/composer.json')) {
|
||||||
|
$ref = dirname($ref);
|
||||||
|
}
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
strtr(dirname(dirname($ref->getFileName())).'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
|
strtr($ref.'/Resources/translations/security.en.xlf', '/', DIRECTORY_SEPARATOR),
|
||||||
$files,
|
$files,
|
||||||
'->registerTranslatorConfiguration() finds Security translation resources'
|
'->registerTranslatorConfiguration() finds Security translation resources'
|
||||||
);
|
);
|
||||||
|
|
|
@ -89,4 +89,9 @@ class SecurityContextTest extends \PHPUnit_Framework_TestCase
|
||||||
$context->setToken($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
|
$context->setToken($token = $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface'));
|
||||||
$this->assertSame($token, $context->getToken());
|
$this->assertSame($token, $context->getToken());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testTranslationsAreNotInCore()
|
||||||
|
{
|
||||||
|
$this->assertFalse(file_exists(__DIR__.'/../../Core/Resources/translations/'));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue