|
33 | 33 | use Symfony\Component\DependencyInjection\Argument\ServiceLocatorArgument; |
34 | 34 | use Symfony\Component\DependencyInjection\Argument\TaggedIteratorArgument; |
35 | 35 | use Symfony\Component\DependencyInjection\ChildDefinition; |
| 36 | +use Symfony\Component\DependencyInjection\Compiler\ResolveBindingsPass; |
36 | 37 | use Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass; |
37 | 38 | use Symfony\Component\DependencyInjection\Compiler\ResolveInstanceofConditionalsPass; |
38 | 39 | use Symfony\Component\DependencyInjection\Compiler\ResolveTaggedIteratorArgumentPass; |
|
68 | 69 | use Symfony\Component\Notifier\TexterInterface; |
69 | 70 | use Symfony\Component\PropertyAccess\PropertyAccessor; |
70 | 71 | use Symfony\Component\Security\Core\AuthenticationEvents; |
| 72 | +use Symfony\Component\Serializer\DependencyInjection\SerializerPass; |
71 | 73 | use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader; |
72 | 74 | use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader; |
73 | 75 | use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader; |
@@ -1525,9 +1527,6 @@ public function testSerializerEnabled() |
1525 | 1527 | $this->assertEquals(AttributeLoader::class, $argument[0]->getClass()); |
1526 | 1528 | $this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.name_converter.metadata_aware')->getArgument(1)); |
1527 | 1529 | $this->assertEquals(new Reference('property_info', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE), $container->getDefinition('serializer.normalizer.object')->getArgument(3)); |
1528 | | - $this->assertArrayHasKey('circular_reference_handler', $container->getDefinition('serializer.normalizer.object')->getArgument(6)); |
1529 | | - $this->assertArrayHasKey('max_depth_handler', $container->getDefinition('serializer.normalizer.object')->getArgument(6)); |
1530 | | - $this->assertEquals($container->getDefinition('serializer.normalizer.object')->getArgument(6)['max_depth_handler'], new Reference('my.max.depth.handler')); |
1531 | 1530 | } |
1532 | 1531 |
|
1533 | 1532 | public function testSerializerWithoutTranslator() |
@@ -1625,13 +1624,22 @@ public function testJsonSerializableNormalizerRegistered() |
1625 | 1624 |
|
1626 | 1625 | public function testObjectNormalizerRegistered() |
1627 | 1626 | { |
1628 | | - $container = $this->createContainerFromFile('full'); |
| 1627 | + $container = $this->createContainerFromFile('full', compile: false); |
| 1628 | + $container->addCompilerPass(new SerializerPass()); |
| 1629 | + $container->addCompilerPass(new ResolveBindingsPass()); |
| 1630 | + $container->compile(); |
1629 | 1631 |
|
1630 | 1632 | $definition = $container->getDefinition('serializer.normalizer.object'); |
1631 | 1633 | $tag = $definition->getTag('serializer.normalizer'); |
1632 | 1634 |
|
1633 | 1635 | $this->assertEquals(ObjectNormalizer::class, $definition->getClass()); |
1634 | 1636 | $this->assertEquals(-1000, $tag[0]['priority']); |
| 1637 | + |
| 1638 | + $this->assertEquals([ |
| 1639 | + 'enable_max_depth' => true, |
| 1640 | + 'circular_reference_handler' => new Reference('my.circular.reference.handler'), |
| 1641 | + 'max_depth_handler' => new Reference('my.max.depth.handler'), |
| 1642 | + ], $definition->getArgument(6)); |
1635 | 1643 | } |
1636 | 1644 |
|
1637 | 1645 | public function testConstraintViolationListNormalizerRegistered() |
|
0 commit comments