public function testNormalize() { $urlGeneratorProphecy = $this->prophesize(UrlGeneratorInterface::class); $urlGeneratorProphecy->generate('api_jsonld_context', ['shortName' => 'ConstraintViolationList'])->willReturn('/context/foo')->shouldBeCalled(); $normalizer = new ConstraintViolationListNormalizer($urlGeneratorProphecy->reveal()); $list = new ConstraintViolationList([new ConstraintViolation('a', 'b', [], 'c', 'd', 'e'), new ConstraintViolation('1', '2', [], '3', '4', '5')]); $expected = ['@context' => '/context/foo', '@type' => 'ConstraintViolationList', 'hydra:title' => 'An error occurred', 'hydra:description' => 'd: a 4: 1', 'violations' => [['propertyPath' => 'd', 'message' => 'a'], ['propertyPath' => '4', 'message' => '1']]]; $this->assertEquals($expected, $normalizer->normalize($list)); }