function YamlTest::testUndefinedConstant

Same name and namespace in other branches
  1. 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 108

Class

YamlTest
Tests the Yaml serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function testUndefinedConstant() : void {
  $this->expectExceptionMessage('The constant "DOES_NOT_EXIST" is not defined');
  $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.