|
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;
|
|
67 | 68 | use Symfony\Component\Notifier\TexterInterface;
|
68 | 69 | use Symfony\Component\PropertyAccess\PropertyAccessor;
|
69 | 70 | use Symfony\Component\Security\Core\AuthenticationEvents;
|
| 71 | +use Symfony\Component\Serializer\DependencyInjection\SerializerPass; |
70 | 72 | use Symfony\Component\Serializer\Mapping\Loader\AttributeLoader;
|
71 | 73 | use Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader;
|
72 | 74 | use Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader;
|
@@ -1447,9 +1449,6 @@ public function testSerializerEnabled()
|
1447 | 1449 | $this->assertEquals(AttributeLoader::class, $argument[0]->getClass());
|
1448 | 1450 | $this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.name_converter.metadata_aware')->getArgument(1));
|
1449 | 1451 | $this->assertEquals(new Reference('property_info', ContainerBuilder::IGNORE_ON_INVALID_REFERENCE), $container->getDefinition('serializer.normalizer.object')->getArgument(3));
|
1450 |
| - $this->assertArrayHasKey('circular_reference_handler', $container->getDefinition('serializer.normalizer.object')->getArgument(6)); |
1451 |
| - $this->assertArrayHasKey('max_depth_handler', $container->getDefinition('serializer.normalizer.object')->getArgument(6)); |
1452 |
| - $this->assertEquals($container->getDefinition('serializer.normalizer.object')->getArgument(6)['max_depth_handler'], new Reference('my.max.depth.handler')); |
1453 | 1452 | }
|
1454 | 1453 |
|
1455 | 1454 | public function testSerializerWithoutTranslator()
|
@@ -1547,13 +1546,22 @@ public function testJsonSerializableNormalizerRegistered()
|
1547 | 1546 |
|
1548 | 1547 | public function testObjectNormalizerRegistered()
|
1549 | 1548 | {
|
1550 |
| - $container = $this->createContainerFromFile('full'); |
| 1549 | + $container = $this->createContainerFromFile('full', compile: false); |
| 1550 | + $container->addCompilerPass(new SerializerPass()); |
| 1551 | + $container->addCompilerPass(new ResolveBindingsPass()); |
| 1552 | + $container->compile(); |
1551 | 1553 |
|
1552 | 1554 | $definition = $container->getDefinition('serializer.normalizer.object');
|
1553 | 1555 | $tag = $definition->getTag('serializer.normalizer');
|
1554 | 1556 |
|
1555 | 1557 | $this->assertEquals(ObjectNormalizer::class, $definition->getClass());
|
1556 | 1558 | $this->assertEquals(-1000, $tag[0]['priority']);
|
| 1559 | + |
| 1560 | + $this->assertEquals([ |
| 1561 | + 'enable_max_depth' => true, |
| 1562 | + 'circular_reference_handler' => new Reference('my.circular.reference.handler'), |
| 1563 | + 'max_depth_handler' => new Reference('my.max.depth.handler'), |
| 1564 | + ], $definition->getArgument(6)); |
1557 | 1565 | }
|
1558 | 1566 |
|
1559 | 1567 | public function testConstraintViolationListNormalizerRegistered()
|
|
0 commit comments