function RecursiveContextualValidatorTest::testBasicValidateWithMultipleConstraints
Same name in other branches
- 9 core/tests/Drupal/Tests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\Tests\Core\TypedData\RecursiveContextualValidatorTest::testBasicValidateWithMultipleConstraints()
- 8.9.x 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 144
Class
- RecursiveContextualValidatorTest
- @coversDefaultClass \Drupal\Core\TypedData\Validation\RecursiveContextualValidator @group TypedData
Namespace
Drupal\Tests\Core\TypedDataCode
public function testBasicValidateWithMultipleConstraints() : void {
$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);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.