function YamlTest::testConstants

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest::testConstants()

Tests decoding PHP constants.

See also

\Drupal\Tests\Component\Serialization\YamlTest::testObjectSupportDisabledPecl()

File

core/tests/Drupal/Tests/Component/Serialization/YamlTest.php, line 97

Class

YamlTest
Tests the Yaml serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function testConstants() : void {
  $yaml = <<<YAML
  foo:
    !php/const PHP_INT_MAX
  YAML;
  $this->assertSame(PHP_INT_MAX, Yaml::decode($yaml)['foo']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.