public function AbstractValidatorTest::testValidateMultipleGroups in Plug 7
File
- lib/
Symfony/ validator/ Symfony/ Component/ Validator/ Tests/ Validator/ AbstractValidatorTest.php, line 1064
Class
- AbstractValidatorTest
- @since 2.5 @author Bernhard Schussek <bschussek@gmail.com>
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);
}