function YamlTest::testUndefinedConstant
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest::testUndefinedConstant()
Tests that missing constants cause exception.
File
-
core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php, line 111
Class
- YamlTest
- Tests the Yaml serialization implementation.
Namespace
Drupal\Tests\Component\SerializationCode
public function testUndefinedConstant() : void {
$this->expectExceptionMessageIs('The constant "DOES_NOT_EXIST" is not defined at line 2 (near "!php/const DOES_NOT_EXIST").');
$yaml = <<<YAML
foo:
!php/const DOES_NOT_EXIST
YAML;
Yaml::decode($yaml);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.