function EntityBundleExistsConstraintValidatorTest::testValueMustBeAString
Same name in other branches
- 11.x core/tests/Drupal/KernelTests/Core/Entity/EntityBundleExistsConstraintValidatorTest.php \Drupal\KernelTests\Core\Entity\EntityBundleExistsConstraintValidatorTest::testValueMustBeAString()
Tests that the constraint validator will only work with strings.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityBundleExistsConstraintValidatorTest.php, line 42
Class
- EntityBundleExistsConstraintValidatorTest
- @group Entity @group Validation
Namespace
Drupal\KernelTests\Core\EntityCode
public function testValueMustBeAString() : void {
$definition = DataDefinition::create('any')->addConstraint('EntityBundleExists', 'entity_test_with_bundle');
$this->expectException(UnexpectedTypeException::class);
$this->expectExceptionMessage('Expected argument of type "string", "int" given');
$this->container
->get('typed_data_manager')
->create($definition, 39)
->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.