Author: Kévin Dunglas (dunglas@gmail.com)
Author: Samuel ROZE (samuel.roze@gmail.com)
Inheritance: implements Symfony\Component\Serializer\Normalizer\NormalizerInterface
Exemplo n.º 1
0
 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']));
 }