ApiPlatform\Core\Tests\Problem\Serializer\ConstraintViolationNormalizerTest::testNormalize PHP Method

testNormalize() public method

public testNormalize ( )
    public function testNormalize()
    {
        $normalizer = new ConstraintViolationListNormalizer();
        $list = new ConstraintViolationList([new ConstraintViolation('a', 'b', [], 'c', 'd', 'e'), new ConstraintViolation('1', '2', [], '3', '4', '5')]);
        $expected = ['type' => 'https://tools.ietf.org/html/rfc2616#section-10', 'title' => 'An error occurred', 'detail' => 'd: a
4: 1', 'violations' => [['propertyPath' => 'd', 'message' => 'a'], ['propertyPath' => '4', 'message' => '1']]];
        $this->assertEquals($expected, $normalizer->normalize($list));
    }
ConstraintViolationNormalizerTest