public function Abstract2Dot5ApiTest::testNoDuplicateValidationIfPropertyConstraintInMultipleGroups in Plug 7
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ Abstract2Dot5ApiTest.php, line 673
Class
- Abstract2Dot5ApiTest
- Verifies that a validator satisfies the API of Symfony 2.5+.
Namespace
Symfony\Component\Validator\Tests\ValidatorCode
public function testNoDuplicateValidationIfPropertyConstraintInMultipleGroups() {
$entity = new Entity();
$callback = function ($value, ExecutionContextInterface $context) {
$context
->addViolation('Message');
};
$this->metadata
->addPropertyConstraint('firstName', new Callback(array(
'callback' => $callback,
'groups' => array(
'Group 1',
'Group 2',
),
)));
$violations = $this->validator
->validate($entity, new Valid(), array(
'Group 1',
'Group 2',
));
/** @var ConstraintViolationInterface[] $violations */
$this
->assertCount(1, $violations);
}