1313
1414use PHPUnit \Framework \TestCase ;
1515use Symfony \Bundle \FrameworkBundle \DependencyInjection \Compiler \AddConstraintValidatorsPass ;
16- use Symfony \Component \DependencyInjection \Argument \ServiceLocatorArgument ;
16+ use Symfony \Component \DependencyInjection \Argument \ServiceClosureArgument ;
1717use Symfony \Component \DependencyInjection \ContainerBuilder ;
18+ use Symfony \Component \DependencyInjection \Definition ;
1819use Symfony \Component \DependencyInjection \Reference ;
20+ use Symfony \Component \DependencyInjection \ServiceLocator ;
1921
2022class AddConstraintValidatorsPassTest extends TestCase
2123{
2224 public function testThatConstraintValidatorServicesAreProcessed ()
2325 {
2426 $ container = new ContainerBuilder ();
2527 $ validatorFactory = $ container ->register ('validator.validator_factory ' )
26- ->setArguments (array (new ServiceLocatorArgument ( array ()) ));
28+ ->addArgument (array ());
2729
2830 $ container ->register ('my_constraint_validator_service1 ' , Validator1::class)
2931 ->addTag ('validator.constraint_validator ' , array ('alias ' => 'my_constraint_validator_alias1 ' ));
@@ -36,11 +38,11 @@ public function testThatConstraintValidatorServicesAreProcessed()
3638 $ addConstraintValidatorsPass = new AddConstraintValidatorsPass ();
3739 $ addConstraintValidatorsPass ->process ($ container );
3840
39- $ this ->assertEquals (new ServiceLocatorArgument (array (
40- Validator1::class => new Reference ('my_constraint_validator_service1 ' ),
41- 'my_constraint_validator_alias1 ' => new Reference ('my_constraint_validator_service1 ' ),
42- Validator2::class => new Reference ('my_constraint_validator_service2 ' ),
43- )), $ validatorFactory ->getArgument (0 ));
41+ $ this ->assertEquals (( new Definition (ServiceLocator::class, array (array (
42+ Validator1::class => new ServiceClosureArgument ( new Reference ('my_constraint_validator_service1 ' ) ),
43+ 'my_constraint_validator_alias1 ' => new ServiceClosureArgument ( new Reference ('my_constraint_validator_service1 ' ) ),
44+ Validator2::class => new ServiceClosureArgument ( new Reference ('my_constraint_validator_service2 ' ) ),
45+ ))))-> addTag ( ' container.service_locator ' ) , $ validatorFactory ->getArgument (0 ));
4446 }
4547
4648 public function testThatCompilerPassIsIgnoredIfThereIsNoConstraintValidatorFactoryDefinition ()
0 commit comments