try{ $serializer->encode( $this->getIntField(), EntityExistence::createEmpty(), $data, $this->getWriteParameterBagMock() )->current(); }catch(WriteConstraintViolationException $e){ static::assertSame('/count', $e->getViolations()->get(0)->getPropertyPath()); /* Unexpected language has to be fixed NEXT-9419 */ // static::assertSame('This value should not be blank.', $e->getViolations()->get(0)->getMessage());
throw$e; } }
// If a mapping is defined, you should not send properties that are undefined.
// Sending undefined fields will throw an UnexpectedFieldException
$keyDiff = array_diff(array_keys($data), $propertyKeys); if(\count($keyDiff)){ foreach($keyDiffas$fieldName){ $parameters->getContext()->getExceptions()->add( newUnexpectedFieldException($fieldPath . '/' . $fieldName, (string)$fieldName) );