function FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation
Same name in other branches
- 9 core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php \Drupal\KernelTests\Core\Entity\FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation()
- 10 core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php \Drupal\KernelTests\Core\Entity\FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation()
- 11.x core/tests/Drupal/KernelTests/Core/Entity/FieldWidgetConstraintValidatorTest.php \Drupal\KernelTests\Core\Entity\FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation()
Tests entity level constraint validation.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ FieldWidgetConstraintValidatorTest.php, line 153
Class
- FieldWidgetConstraintValidatorTest
- Tests validation constraints for FieldWidgetConstraintValidatorTest.
Namespace
Drupal\KernelTests\Core\EntityCode
public function testEntityLevelConstraintValidation() {
$entity = EntityTestCompositeConstraint::create([
'name' => 'entity-level-violation',
]);
$entity->save();
$errors = $this->getErrorsForEntity($entity);
$this->assertEqual($errors[''], 'Entity level validation');
$entity->name->value = 'entity-level-violation-with-path';
$errors = $this->getErrorsForEntity($entity);
$this->assertEqual($errors['test][form][element'], 'Entity level validation');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.