You are here

public function FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/system/src/Tests/Entity/FieldWidgetConstraintValidatorTest.php \Drupal\system\Tests\Entity\FieldWidgetConstraintValidatorTest::testEntityLevelConstraintValidation()

Tests entity level constraint validation.

File

core/modules/system/src/Tests/Entity/FieldWidgetConstraintValidatorTest.php, line 148
Contains \Drupal\system\Tests\Entity\FieldWidgetConstraintValidatorTest.

Class

FieldWidgetConstraintValidatorTest
Tests validation constraints for FieldWidgetConstraintValidatorTest.

Namespace

Drupal\system\Tests\Entity

Code

public function testEntityLevelConstraintValidation() {
  $entity = EntityTestCompositeConstraint::create([
    'name' => 'entity-level-violation',
  ]);
  $entity
    ->save();
  $errors = $this
    ->getErrorsForEntity($entity);
  $this
    ->assertEqual($errors[''], 'Entity level validation');
}