@@ -749,7 +749,7 @@ public function testSerializerEnabled()
749
749
750
750
$ argument = $ container ->getDefinition ('serializer.mapping.chain_loader ' )->getArgument (0 );
751
751
752
- $ this ->assertCount (1 , $ argument );
752
+ $ this ->assertCount (2 , $ argument );
753
753
$ this ->assertEquals ('Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader ' , $ argument [0 ]->getClass ());
754
754
$ this ->assertNull ($ container ->getDefinition ('serializer.mapping.class_metadata_factory ' )->getArgument (1 ));
755
755
$ this ->assertEquals (new Reference ('serializer.name_converter.camel_case_to_snake_case ' ), $ container ->getDefinition ('serializer.normalizer.object ' )->getArgument (1 ));
@@ -861,23 +861,33 @@ public function testDeprecatedSerializerCacheOption()
861
861
public function testSerializerMapping ()
862
862
{
863
863
$ container = $ this ->createContainerFromFile ('serializer_mapping ' , array ('kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'path ' => __DIR__ .'/Fixtures/TestBundle ' , 'parent ' => null ))));
864
+ $ projectDir = $ container ->getParameter ('kernel.project_dir ' );
864
865
$ configDir = __DIR__ .'/Fixtures/TestBundle/Resources/config ' ;
865
866
$ expectedLoaders = array (
866
867
new Definition (AnnotationLoader::class, array (new Reference ('annotation_reader ' ))),
867
868
new Definition (XmlFileLoader::class, array ($ configDir .'/serialization.xml ' )),
868
869
new Definition (YamlFileLoader::class, array ($ configDir .'/serialization.yml ' )),
870
+ new Definition (YamlFileLoader::class, array ($ projectDir .'/config/serializer/foo.yml ' )),
869
871
new Definition (XmlFileLoader::class, array ($ configDir .'/serializer_mapping/files/foo.xml ' )),
870
872
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/files/foo.yml ' )),
871
873
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/serialization.yml ' )),
872
874
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/serialization.yaml ' )),
873
875
);
874
876
875
877
foreach ($ expectedLoaders as $ definition ) {
878
+ if (is_file ($ arg = $ definition ->getArgument (0 ))) {
879
+ $ definition ->replaceArgument (0 , strtr ($ arg , '/ ' , DIRECTORY_SEPARATOR ));
880
+ }
876
881
$ definition ->setPublic (false );
877
882
}
878
883
879
884
$ loaders = $ container ->getDefinition ('serializer.mapping.chain_loader ' )->getArgument (0 );
880
- $ this ->assertEquals (sort ($ expectedLoaders ), sort ($ loaders ));
885
+ foreach ($ loaders as $ loader ) {
886
+ if (is_file ($ arg = $ loader ->getArgument (0 ))) {
887
+ $ loader ->replaceArgument (0 , strtr ($ arg , '/ ' , DIRECTORY_SEPARATOR ));
888
+ }
889
+ }
890
+ $ this ->assertEquals ($ expectedLoaders , $ loaders );
881
891
}
882
892
883
893
public function testAssetHelperWhenAssetsAreEnabled ()
0 commit comments