public function AbstractValidatorTest::testValidateMultipleGroups in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/symfony/validator/Tests/Validator/AbstractValidatorTest.php \Symfony\Component\Validator\Tests\Validator\AbstractValidatorTest::testValidateMultipleGroups()
File
- vendor/
symfony/ validator/ Tests/ Validator/ AbstractValidatorTest.php, line 1061
Class
- AbstractValidatorTest
- @since 2.5
Namespace
Symfony\Component\Validator\Tests\ValidatorCode
public function testValidateMultipleGroups() {
$entity = new Entity();
$callback = function ($value, ExecutionContextInterface $context) {
$context
->addViolation('Message');
};
$this->metadata
->addConstraint(new Callback(array(
'callback' => $callback,
'groups' => 'Group 1',
)));
$this->metadata
->addConstraint(new Callback(array(
'callback' => $callback,
'groups' => 'Group 2',
)));
$violations = $this
->validate($entity, null, array(
'Group 1',
'Group 2',
));
/* @var ConstraintViolationInterface[] $violations */
$this
->assertCount(2, $violations);
}