function RecursiveContextualValidatorTest::testRecursiveValidate
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\KernelTests\Core\TypedData\RecursiveContextualValidatorTest::testRecursiveValidate()
- 10 core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\KernelTests\Core\TypedData\RecursiveContextualValidatorTest::testRecursiveValidate()
- 11.x core/tests/Drupal/KernelTests/Core/TypedData/RecursiveContextualValidatorTest.php \Drupal\KernelTests\Core\TypedData\RecursiveContextualValidatorTest::testRecursiveValidate()
Tests recursive validation against given constraints against an entity.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ TypedData/ RecursiveContextualValidatorTest.php, line 36
Class
- RecursiveContextualValidatorTest
- @coversDefaultClass \Drupal\Core\TypedData\Validation\RecursiveContextualValidator @group Validation
Namespace
Drupal\KernelTests\Core\TypedDataCode
public function testRecursiveValidate() {
$entity = EntityTest::create();
$adapter = EntityAdapter::createFromEntity($entity);
// This would trigger the ValidReferenceConstraint due to EntityTest
// defaulting uid to 1, which doesn't exist. Ensure that we don't get a
// violation for that.
$this->assertCount(0, \Drupal::typedDataManager()->getValidator()
->validate($adapter, $adapter->getConstraints()));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.