public function RecursiveContextualValidatorTest::testBasicValidateWithMultipleConstraints in Drupal 8
Same name and namespace in other branches
- 9 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::testBasicValidateWithMultipleConstraints()
- 10 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::testBasicValidateWithMultipleConstraints()
@covers ::validate
File
- core/
tests/ Drupal/ Tests/ Core/ TypedData/ RecursiveContextualValidatorTest.php, line 146 - Contains \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest.
Class
- RecursiveContextualValidatorTest
- @coversDefaultClass \Drupal\Core\TypedData\Validation\RecursiveContextualValidator @group typedData
Namespace
Drupal\Tests\Core\TypedDataCode
public function testBasicValidateWithMultipleConstraints() {
$options = [
'callback' => function ($value, ExecutionContextInterface $context) {
$context
->addViolation('test violation');
},
];
$typed_data = $this->typedDataManager
->create(DataDefinition::create('string')
->addConstraint('Callback', $options)
->addConstraint('NotNull'));
$violations = $this->recursiveValidator
->validate($typed_data);
$this
->assertCount(2, $violations);
}