$this->
buildViolation('myMessage'
) ->
atPath('property.path.name'
) ->
setParameter('{{ value }}', '"Foo"'
) ->
setInvalidValue($entity2) ->
setCause([$entity1]) ->
setCode(UniqueEntity::NOT_UNIQUE_ERROR
) ->
assertRaised();
} public static function provideUniquenessConstraints(): iterable
{ yield 'Doctrine style' =>
[new UniqueEntity([ 'message' => 'myMessage',
'fields' =>
['name'
],
'em' => self::EM_NAME,
])];
yield 'Named arguments' =>
[new UniqueEntity(message: 'myMessage', fields:
['name'
], em: 'foo'
)];
} /**
* @dataProvider provideConstraintsWithCustomErrorPath
*/