ApiPlatform\Core\Tests\Hal\Serializer\EntrypointNormalizerTest::testNormalize PHP Method

testNormalize() public method

public testNormalize ( )
    public function testNormalize()
    {
        $collection = new ResourceNameCollection([Dummy::class]);
        $entrypoint = new Entrypoint($collection);
        $factoryProphecy = $this->prophesize(ResourceMetadataFactoryInterface::class);
        $factoryProphecy->create(Dummy::class)->willReturn(new ResourceMetadata('Dummy', null, null, null, ['get']))->shouldBeCalled();
        $iriConverterProphecy = $this->prophesize(IriConverterInterface::class);
        $iriConverterProphecy->getIriFromResourceClass(Dummy::class)->willReturn('/api/dummies')->shouldBeCalled();
        $urlGeneratorProphecy = $this->prophesize(UrlGeneratorInterface::class);
        $urlGeneratorProphecy->generate('api_entrypoint')->willReturn('/api')->shouldBeCalled();
        $normalizer = new EntrypointNormalizer($factoryProphecy->reveal(), $iriConverterProphecy->reveal(), $urlGeneratorProphecy->reveal());
        $expected = ['_links' => ['self' => ['href' => '/api'], 'dummy' => ['href' => '/api/dummies']]];
        $this->assertEquals($expected, $normalizer->normalize($entrypoint, EntrypointNormalizer::FORMAT));
    }