function CssSelectorConstraintValidatorTest::testValidatedValueMustBeAString
Same name and namespace in other branches
- main core/tests/Drupal/KernelTests/Core/Theme/DesignToken/CssSelectorConstraintValidatorTest.php \Drupal\KernelTests\Core\Theme\DesignToken\CssSelectorConstraintValidatorTest::testValidatedValueMustBeAString()
Tests invalid type.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Theme/ DesignToken/ CssSelectorConstraintValidatorTest.php, line 77
Class
- CssSelectorConstraintValidatorTest
- Tests Css Selector Constraint Validator.
Namespace
Drupal\KernelTests\Core\Theme\DesignTokenCode
public function testValidatedValueMustBeAString() : void {
$definition = DataDefinition::create('string')->addConstraint('CssSelector');
$data = $this->container
->get(TypedDataManagerInterface::class)
->create($definition);
$data->setValue(5);
$this->expectException(UnexpectedValueException::class);
$this->expectExceptionMessage('Expected argument of type "string", "int" given');
$data->validate();
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.