@@ -742,7 +742,7 @@ public function testSerializerEnabled()
742
742
743
743
$ argument = $ container ->getDefinition ('serializer.mapping.chain_loader ' )->getArgument (0 );
744
744
745
- $ this ->assertCount (1 , $ argument );
745
+ $ this ->assertCount (2 , $ argument );
746
746
$ this ->assertEquals ('Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader ' , $ argument [0 ]->getClass ());
747
747
$ this ->assertNull ($ container ->getDefinition ('serializer.mapping.class_metadata_factory ' )->getArgument (1 ));
748
748
$ this ->assertEquals (new Reference ('serializer.name_converter.camel_case_to_snake_case ' ), $ container ->getDefinition ('serializer.normalizer.object ' )->getArgument (1 ));
@@ -839,23 +839,33 @@ public function testSerializerCacheDisabled()
839
839
public function testSerializerMapping ()
840
840
{
841
841
$ container = $ this ->createContainerFromFile ('serializer_mapping ' , array ('kernel.bundles_metadata ' => array ('TestBundle ' => array ('namespace ' => 'Symfony \\Bundle \\FrameworkBundle \\Tests ' , 'path ' => __DIR__ .'/Fixtures/TestBundle ' ))));
842
+ $ projectDir = $ container ->getParameter ('kernel.project_dir ' );
842
843
$ configDir = __DIR__ .'/Fixtures/TestBundle/Resources/config ' ;
843
844
$ expectedLoaders = array (
844
845
new Definition (AnnotationLoader::class, array (new Reference ('annotation_reader ' ))),
845
846
new Definition (XmlFileLoader::class, array ($ configDir .'/serialization.xml ' )),
846
847
new Definition (YamlFileLoader::class, array ($ configDir .'/serialization.yml ' )),
848
+ new Definition (YamlFileLoader::class, array ($ projectDir .'/config/serializer/foo.yml ' )),
847
849
new Definition (XmlFileLoader::class, array ($ configDir .'/serializer_mapping/files/foo.xml ' )),
848
850
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/files/foo.yml ' )),
849
851
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/serialization.yml ' )),
850
852
new Definition (YamlFileLoader::class, array ($ configDir .'/serializer_mapping/serialization.yaml ' )),
851
853
);
852
854
853
855
foreach ($ expectedLoaders as $ definition ) {
856
+ if (is_file ($ arg = $ definition ->getArgument (0 ))) {
857
+ $ definition ->replaceArgument (0 , str_replace ('/ ' , DIRECTORY_SEPARATOR , $ arg ));
858
+ }
854
859
$ definition ->setPublic (false );
855
860
}
856
861
857
862
$ loaders = $ container ->getDefinition ('serializer.mapping.chain_loader ' )->getArgument (0 );
858
- $ this ->assertEquals (sort ($ expectedLoaders ), sort ($ loaders ));
863
+ foreach ($ loaders as $ loader ) {
864
+ if (is_file ($ arg = $ loader ->getArgument (0 ))) {
865
+ $ loader ->replaceArgument (0 , str_replace ('/ ' , DIRECTORY_SEPARATOR , $ arg ));
866
+ }
867
+ }
868
+ $ this ->assertEquals ($ expectedLoaders , $ loaders );
859
869
}
860
870
861
871
public function testAssetHelperWhenAssetsAreEnabled ()
0 commit comments