$this->metadata->
addConstraint(new Callback([ 'callback' =>
$callback1,
'groups' => 'Group 2',
]));
$this->metadata->
addConstraint(new Callback([ 'callback' =>
$callback2,
'groups' => 'Group 3',
]));
$sequence =
new GroupSequence(['Group 1', 'Group 2', 'Group 3', 'Entity'
]);
$this->metadata->
setGroupSequence($sequence);
$violations =
$this->
validate($entity, null, 'Default'
);
/* @var ConstraintViolationInterface[] $violations */
$this->
assertCount(1,
$violations);
$this->
assertSame('Violation in Group 2',
$violations[0
]->
getMessage());
} public function testReplaceDefaultGroupByGroupSequenceArray() { $entity =
new Entity();