ApiPlatform\Core\Tests\Hydra\Serializer\ErrorNormalizerTest::testNormalize PHP Method

testNormalize() public method

public testNormalize ( )
    public function testNormalize()
    {
        $urlGeneratorProphecy = $this->prophesize(UrlGeneratorInterface::class);
        $urlGeneratorProphecy->generate('api_jsonld_context', ['shortName' => 'Error'])->willReturn('/context/foo')->shouldBeCalled();
        $normalizer = new ErrorNormalizer($urlGeneratorProphecy->reveal());
        $this->assertEquals(['@context' => '/context/foo', '@type' => 'Error', 'hydra:title' => 'An error occurred', 'hydra:description' => 'Hello'], $normalizer->normalize(new \Exception('Hello')));
        $this->assertEquals(['@context' => '/context/foo', '@type' => 'Error', 'hydra:title' => 'Hi', 'hydra:description' => 'Hello'], $normalizer->normalize(new \Exception('Hello'), null, ['title' => 'Hi']));
    }