function ImmutablePropertiesConstraintValidatorTest::testValidatorRequiresAConfigEntity
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Entity/ImmutablePropertiesConstraintValidatorTest.php \Drupal\KernelTests\Core\Entity\ImmutablePropertiesConstraintValidatorTest::testValidatorRequiresAConfigEntity()
Tests that only config entities are accepted by the validator.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ ImmutablePropertiesConstraintValidatorTest.php, line 32
Class
- ImmutablePropertiesConstraintValidatorTest
- @group Entity @group Validation
Namespace
Drupal\KernelTests\Core\EntityCode
public function testValidatorRequiresAConfigEntity() : void {
$definition = DataDefinition::createFromDataType('any')->addConstraint('ImmutableProperties', [
'read_only',
]);
$data = $this->container
->get(TypedDataManagerInterface::class)
->create($definition, 39);
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Expected argument of type "' . ConfigEntityInterface::class . '", "int" given');
$data->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.