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

Skip to content

Commit b9f5792

Browse files
committed
Fix tests
1 parent 431ec19 commit b9f5792

File tree

4 files changed

+43
-37
lines changed

4 files changed

+43
-37
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/UnusedTagsPass.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ class UnusedTagsPass implements CompilerPassInterface
8181
'translation.dumper',
8282
'translation.extractor',
8383
'translation.loader',
84+
'translation.remote_factory',
8485
'twig.extension',
8586
'twig.loader',
8687
'twig.runtime',

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

Lines changed: 38 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,8 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
10991099
if (!$this->isConfigEnabled($container, $config)) {
11001100
$container->removeDefinition('console.command.translation_debug');
11011101
$container->removeDefinition('console.command.translation_update');
1102+
$container->removeDefinition('console.command.translation_pull');
1103+
$container->removeDefinition('console.command.translation_push');
11021104

11031105
return;
11041106
}
@@ -1165,6 +1167,42 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
11651167
$container->getDefinition('console.command.translation_update')->replaceArgument(6, $transPaths);
11661168
}
11671169

1170+
if (!empty($config['remotes'])) {
1171+
if (empty($config['enabled_locales'])) {
1172+
throw new LogicException('You must specify framework.translator.enabled_locales in order to use remotes.');
1173+
}
1174+
1175+
if ($container->hasDefinition('console.command.translation_pull')) {
1176+
$container->getDefinition('console.command.translation_pull')
1177+
->replaceArgument(5, $transPaths)
1178+
->replaceArgument(6, $config['enabled_locales'])
1179+
;
1180+
}
1181+
1182+
if ($container->hasDefinition('console.command.translation_push')) {
1183+
$container->getDefinition('console.command.translation_push')
1184+
->replaceArgument(3, $transPaths)
1185+
->replaceArgument(4, $config['enabled_locales'])
1186+
;
1187+
}
1188+
1189+
$container->getDefinition('translation.remotes_factory')
1190+
->replaceArgument(1, $config['enabled_locales'])
1191+
;
1192+
1193+
$container->getDefinition('translation.remotes')->setArgument(0, $config['remotes']);
1194+
1195+
$classToServices = [
1196+
LocoRemoteFactory::class => 'translation.remote_factory.loco',
1197+
];
1198+
1199+
foreach ($classToServices as $class => $service) {
1200+
if (!class_exists($class)) {
1201+
$container->removeDefinition($service);
1202+
}
1203+
}
1204+
}
1205+
11681206
if ($container->fileExists($defaultDir)) {
11691207
$dirs[] = $defaultDir;
11701208
} else {
@@ -1211,42 +1249,6 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
12111249

12121250
$translator->replaceArgument(4, $options);
12131251
}
1214-
1215-
if (!empty($config['remotes'])) {
1216-
if (empty($config['enabled_locales'])) {
1217-
throw new LogicException('You must specify framework.translator.enabled_locales in order to use remotes.');
1218-
}
1219-
1220-
if ($container->hasDefinition('console.command.translation_pull')) {
1221-
$container->getDefinition('console.command.translation_pull')
1222-
->replaceArgument(5, $transPaths)
1223-
->replaceArgument(6, $config['enabled_locales'])
1224-
;
1225-
}
1226-
1227-
if ($container->hasDefinition('console.command.translation_push')) {
1228-
$container->getDefinition('console.command.translation_push')
1229-
->replaceArgument(3, $transPaths)
1230-
->replaceArgument(4, $config['enabled_locales'])
1231-
;
1232-
}
1233-
1234-
$container->getDefinition('translation.remotes_factory')
1235-
->replaceArgument(1, $config['enabled_locales'])
1236-
;
1237-
1238-
$container->getDefinition('translation.remotes')->setArgument(0, $config['remotes']);
1239-
1240-
$classToServices = [
1241-
LocoRemoteFactory::class => 'translation.remote_factory.loco',
1242-
];
1243-
1244-
foreach ($classToServices as $class => $service) {
1245-
if (!class_exists($class)) {
1246-
$container->removeDefinition($service);
1247-
}
1248-
}
1249-
}
12501252
}
12511253

12521254
private function registerValidationConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader, bool $propertyInfoEnabled)

src/Symfony/Bundle/FrameworkBundle/Resources/config/translation_remotes.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@
2525
->abstract()
2626

2727
->set('translation.remote_factory.loco', LocoRemoteFactory::class)
28-
->args([service('translator.data_collector')])
28+
->args([
29+
service('translator.data_collector')->nullOnInvalid(),
30+
])
2931
->parent('translation.remote_factory.abstract')
3032
->tag('translation.remote_factory')
3133
;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@ protected static function getBundleDefaultConfig()
378378
'paths' => [],
379379
'default_path' => '%kernel.project_dir%/translations',
380380
'enabled_locales' => [],
381+
'remotes' => [],
381382
],
382383
'validation' => [
383384
'enabled' => !class_exists(FullStack::class),

0 commit comments

Comments
 (0)