21
21
use ApiPlatform \Core \Metadata \Resource \ResourceMetadata ;
22
22
use ApiPlatform \Core \Metadata \Resource \ResourceNameCollection ;
23
23
use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \Dummy ;
24
+ use ApiPlatform \Core \Tests \Fixtures \TestBundle \Entity \FooDummy ;
24
25
use PHPUnit \Framework \TestCase ;
25
26
26
27
/**
@@ -47,14 +48,16 @@ public function testSupportNormalization()
47
48
48
49
public function testNormalize ()
49
50
{
50
- $ collection = new ResourceNameCollection ([Dummy::class]);
51
+ $ collection = new ResourceNameCollection ([FooDummy::class, Dummy::class]);
51
52
$ entrypoint = new Entrypoint ($ collection );
52
53
53
54
$ factoryProphecy = $ this ->prophesize (ResourceMetadataFactoryInterface::class);
54
55
$ factoryProphecy ->create (Dummy::class)->willReturn (new ResourceMetadata ('Dummy ' , null , null , null , ['get ' ]))->shouldBeCalled ();
56
+ $ factoryProphecy ->create (FooDummy::class)->willReturn (new ResourceMetadata ('FooDummy ' , null , null , null , ['get ' ]))->shouldBeCalled ();
55
57
56
58
$ iriConverterProphecy = $ this ->prophesize (IriConverterInterface::class);
57
59
$ iriConverterProphecy ->getIriFromResourceClass (Dummy::class)->willReturn ('/api/dummies ' )->shouldBeCalled ();
60
+ $ iriConverterProphecy ->getIriFromResourceClass (FooDummy::class)->willReturn ('/api/foo_dummies ' )->shouldBeCalled ();
58
61
59
62
$ urlGeneratorProphecy = $ this ->prophesize (UrlGeneratorInterface::class);
60
63
$ urlGeneratorProphecy ->generate ('api_entrypoint ' )->willReturn ('/api ' )->shouldBeCalled ();
@@ -67,6 +70,7 @@ public function testNormalize()
67
70
'@id ' => '/api ' ,
68
71
'@type ' => 'Entrypoint ' ,
69
72
'dummy ' => '/api/dummies ' ,
73
+ 'fooDummy ' => '/api/foo_dummies ' ,
70
74
];
71
75
$ this ->assertEquals ($ expected , $ normalizer ->normalize ($ entrypoint , EntrypointNormalizer::FORMAT ));
72
76
}
0 commit comments