8080use Symfony \Component \Translation \DependencyInjection \TranslatorPass ;
8181use Symfony \Component \Translation \LocaleSwitcher ;
8282use Symfony \Component \Validator \DependencyInjection \AddConstraintValidatorsPass ;
83+ use Symfony \Component \Validator \DependencyInjection \AddGroupSequenceProvidersPass ;
8384use Symfony \Component \Validator \Validation ;
8485use Symfony \Component \Validator \Validator \ValidatorInterface ;
8586use Symfony \Component \Validator \ValidatorBuilder ;
@@ -1230,16 +1231,18 @@ public function testValidation()
12301231
12311232 $ annotations = !class_exists (FullStack::class);
12321233
1233- $ this ->assertCount ($ annotations ? 7 : 6 , $ calls );
1234+ $ this ->assertCount ($ annotations ? 8 : 7 , $ calls );
12341235 $ this ->assertSame ('setConstraintValidatorFactory ' , $ calls [0 ][0 ]);
12351236 $ this ->assertEquals ([new Reference ('validator.validator_factory ' )], $ calls [0 ][1 ]);
1236- $ this ->assertSame ('setTranslator ' , $ calls [1 ][0 ]);
1237- $ this ->assertEquals ([new Reference ('translator ' , ContainerBuilder::IGNORE_ON_INVALID_REFERENCE )], $ calls [1 ][1 ]);
1238- $ this ->assertSame ('setTranslationDomain ' , $ calls [2 ][0 ]);
1239- $ this ->assertSame (['%validator.translation_domain% ' ], $ calls [2 ][1 ]);
1240- $ this ->assertSame ('addXmlMappings ' , $ calls [3 ][0 ]);
1241- $ this ->assertSame ([$ xmlMappings ], $ calls [3 ][1 ]);
1242- $ i = 3 ;
1237+ $ this ->assertSame ('setGroupSequenceProviderFactory ' , $ calls [1 ][0 ]);
1238+ $ this ->assertEquals ([new Reference ('validator.group_sequence_provider_factory ' )], $ calls [1 ][1 ]);
1239+ $ this ->assertSame ('setTranslator ' , $ calls [2 ][0 ]);
1240+ $ this ->assertEquals ([new Reference ('translator ' , ContainerBuilder::IGNORE_ON_INVALID_REFERENCE )], $ calls [2 ][1 ]);
1241+ $ this ->assertSame ('setTranslationDomain ' , $ calls [3 ][0 ]);
1242+ $ this ->assertSame (['%validator.translation_domain% ' ], $ calls [3 ][1 ]);
1243+ $ this ->assertSame ('addXmlMappings ' , $ calls [4 ][0 ]);
1244+ $ this ->assertSame ([$ xmlMappings ], $ calls [4 ][1 ]);
1245+ $ i = 4 ;
12431246 if ($ annotations ) {
12441247 $ this ->assertSame ('enableAnnotationMapping ' , $ calls [++$ i ][0 ]);
12451248 }
@@ -1288,12 +1291,12 @@ public function testValidationAnnotations()
12881291
12891292 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
12901293
1291- $ this ->assertCount (7 , $ calls );
1292- $ this ->assertSame ('enableAnnotationMapping ' , $ calls [4 ][0 ]);
1293- $ this ->assertSame ('addMethodMapping ' , $ calls [5 ][0 ]);
1294- $ this ->assertSame (['loadValidatorMetadata ' ], $ calls [5 ][1 ]);
1295- $ this ->assertSame ('setMappingCache ' , $ calls [6 ][0 ]);
1296- $ this ->assertEquals ([new Reference ('validator.mapping.cache.adapter ' )], $ calls [6 ][1 ]);
1294+ $ this ->assertCount (8 , $ calls );
1295+ $ this ->assertSame ('enableAnnotationMapping ' , $ calls [5 ][0 ]);
1296+ $ this ->assertSame ('addMethodMapping ' , $ calls [6 ][0 ]);
1297+ $ this ->assertSame (['loadValidatorMetadata ' ], $ calls [6 ][1 ]);
1298+ $ this ->assertSame ('setMappingCache ' , $ calls [7 ][0 ]);
1299+ $ this ->assertEquals ([new Reference ('validator.mapping.cache.adapter ' )], $ calls [7 ][1 ]);
12971300 // no cache this time
12981301 }
12991302
@@ -1308,14 +1311,14 @@ public function testValidationLegacyAnnotations()
13081311
13091312 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
13101313
1311- $ this ->assertCount (8 , $ calls );
1312- $ this ->assertSame ('enableAnnotationMapping ' , $ calls [4 ][0 ]);
1314+ $ this ->assertCount (9 , $ calls );
1315+ $ this ->assertSame ('enableAnnotationMapping ' , $ calls [5 ][0 ]);
13131316 if (method_exists (ValidatorBuilder::class, 'setDoctrineAnnotationReader ' )) {
1314- $ this ->assertSame ('setDoctrineAnnotationReader ' , $ calls [5 ][0 ]);
1315- $ this ->assertEquals ([new Reference ('annotation_reader ' )], $ calls [5 ][1 ]);
1316- $ i = 6 ;
1317+ $ this ->assertSame ('setDoctrineAnnotationReader ' , $ calls [6 ][0 ]);
1318+ $ this ->assertEquals ([new Reference ('annotation_reader ' )], $ calls [6 ][1 ]);
1319+ $ i = 7 ;
13171320 } else {
1318- $ i = 5 ;
1321+ $ i = 6 ;
13191322 }
13201323 $ this ->assertSame ('addMethodMapping ' , $ calls [$ i ][0 ]);
13211324 $ this ->assertSame (['loadValidatorMetadata ' ], $ calls [$ i ][1 ]);
@@ -1335,16 +1338,16 @@ public function testValidationPaths()
13351338
13361339 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
13371340
1338- $ this ->assertCount (8 , $ calls );
1339- $ this ->assertSame ('addXmlMappings ' , $ calls [3 ][0 ]);
1340- $ this ->assertSame ('addYamlMappings ' , $ calls [4 ][0 ]);
1341- $ this ->assertSame ('enableAnnotationMapping ' , $ calls [5 ][0 ]);
1342- $ this ->assertSame ('addMethodMapping ' , $ calls [6 ][0 ]);
1343- $ this ->assertSame (['loadValidatorMetadata ' ], $ calls [6 ][1 ]);
1344- $ this ->assertSame ('setMappingCache ' , $ calls [7 ][0 ]);
1345- $ this ->assertEquals ([new Reference ('validator.mapping.cache.adapter ' )], $ calls [7 ][1 ]);
1341+ $ this ->assertCount (9 , $ calls );
1342+ $ this ->assertSame ('addXmlMappings ' , $ calls [4 ][0 ]);
1343+ $ this ->assertSame ('addYamlMappings ' , $ calls [5 ][0 ]);
1344+ $ this ->assertSame ('enableAnnotationMapping ' , $ calls [6 ][0 ]);
1345+ $ this ->assertSame ('addMethodMapping ' , $ calls [7 ][0 ]);
1346+ $ this ->assertSame (['loadValidatorMetadata ' ], $ calls [7 ][1 ]);
1347+ $ this ->assertSame ('setMappingCache ' , $ calls [8 ][0 ]);
1348+ $ this ->assertEquals ([new Reference ('validator.mapping.cache.adapter ' )], $ calls [8 ][1 ]);
13461349
1347- $ xmlMappings = $ calls [3 ][1 ][0 ];
1350+ $ xmlMappings = $ calls [4 ][1 ][0 ];
13481351 $ this ->assertCount (3 , $ xmlMappings );
13491352 try {
13501353 // Testing symfony/symfony
@@ -1355,7 +1358,7 @@ public function testValidationPaths()
13551358 }
13561359 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
13571360
1358- $ yamlMappings = $ calls [4 ][1 ][0 ];
1361+ $ yamlMappings = $ calls [5 ][1 ][0 ];
13591362 $ this ->assertCount (1 , $ yamlMappings );
13601363 $ this ->assertStringEndsWith ('TestBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
13611364 }
@@ -1370,7 +1373,7 @@ public function testValidationPathsUsingCustomBundlePath()
13701373 ]);
13711374
13721375 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
1373- $ xmlMappings = $ calls [3 ][1 ][0 ];
1376+ $ xmlMappings = $ calls [4 ][1 ][0 ];
13741377 $ this ->assertCount (3 , $ xmlMappings );
13751378
13761379 try {
@@ -1382,7 +1385,7 @@ public function testValidationPathsUsingCustomBundlePath()
13821385 }
13831386 $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.xml ' , $ xmlMappings [1 ]);
13841387
1385- $ yamlMappings = $ calls [4 ][1 ][0 ];
1388+ $ yamlMappings = $ calls [5 ][1 ][0 ];
13861389 $ this ->assertCount (1 , $ yamlMappings );
13871390 $ this ->assertStringEndsWith ('CustomPathBundle/Resources/config/validation.yml ' , $ yamlMappings [0 ]);
13881391 }
@@ -1395,9 +1398,9 @@ public function testValidationNoStaticMethod()
13951398
13961399 $ annotations = !cl
58D6
ass_exists (FullStack::class);
13971400
1398- $ this ->assertCount ($ annotations ? 6 : 5 , $ calls );
1399- $ this ->assertSame ('addXmlMappings ' , $ calls [3 ][0 ]);
1400- $ i = 3 ;
1401+ $ this ->assertCount ($ annotations ? 7 : 6 , $ calls );
1402+ $ this ->assertSame ('addXmlMappings ' , $ calls [4 ][0 ]);
1403+ $ i = 4 ;
14011404 if ($ annotations ) {
14021405 $ this ->assertSame ('enableAnnotationMapping ' , $ calls [++$ i ][0 ]);
14031406 }
@@ -1426,14 +1429,14 @@ public function testValidationMapping()
14261429
14271430 $ calls = $ container ->getDefinition ('validator.builder ' )->getMethodCalls ();
14281431
1429- $ this ->assertSame ('addXmlMappings ' , $ calls [3 ][0 ]);
1430- $ this ->assertCount (3 , $ calls [3 ][1 ][0 ]);
1431-
1432- $ this ->assertSame ('addYamlMappings ' , $ calls [4 ][0 ]);
1432+ $ this ->assertSame ('addXmlMappings ' , $ calls [4 ][0 ]);
14331433 $ this ->assertCount (3 , $ calls [4 ][1 ][0 ]);
1434- $ this ->assertStringContainsString ('foo.yml ' , $ calls [4 ][1 ][0 ][0 ]);
1435- $ this ->assertStringContainsString ('validation.yml ' , $ calls [4 ][1 ][0 ][1 ]);
1436- $ this ->assertStringContainsString ('validation.yaml ' , $ calls [4 ][1 ][0 ][2 ]);
1434+
1435+ $ this ->assertSame ('addYamlMappings ' , $ calls [5 ][0 ]);
1436+ $ this ->assertCount (3 , $ calls [5 ][1 ][0 ]);
1437+ $ this ->assertStringContainsString ('foo.yml ' , $ calls [5 ][1 ][0 ][0 ]);
1438+ $ this ->assertStringContainsString ('validation.yml ' , $ calls [5 ][1 ][0 ][1 ]);
1439+ $ this ->assertStringContainsString ('validation.yaml ' , $ calls [5 ][1 ][0 ][2 ]);
14371440 }
14381441
14391442 public function testValidationAutoMapping ()
@@ -2383,7 +2386,7 @@ protected function createContainerFromFile(string $file, array $data = [], bool
23832386 $ container ->getCompilerPassConfig ()->setAfterRemovingPasses ([]);
23842387 }
23852388 $ container ->getCompilerPassConfig ()->setBeforeOptimizationPasses ([new LoggerPass ()]);
2386- $ container ->getCompilerPassConfig ()->setBeforeRemovingPasses ([new AddConstraintValidatorsPass (), new TranslatorPass ()]);
2389+ $ container ->getCompilerPassConfig ()->setBeforeRemovingPasses ([new AddConstraintValidatorsPass (), new AddGroupSequenceProvidersPass (), new TranslatorPass ()]);
23872390 $ container ->getCompilerPassConfig ()->setAfterRemovingPasses ([new AddAnnotationsCachedReaderPass ()]);
23882391
23892392 if (!$ compile ) {
0 commit comments