function YamlSymfonyTest::testCustomTagSupport

Same name in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php \Drupal\Tests\Component\Serialization\YamlSymfonyTest::testCustomTagSupport()

Tests that YAML custom tags are supported and parsed.

@covers ::decode

@dataProvider taggedValuesProvider

File

core/tests/Drupal/Tests/Component/Serialization/YamlSymfonyTest.php, line 117

Class

YamlSymfonyTest
Tests the YamlSymfony serialization implementation.

Namespace

Drupal\Tests\Component\Serialization

Code

public function testCustomTagSupport($expected, $yaml) : void {
    try {
        $this->assertEquals($expected, YamlSymfony::decode($yaml));
    } catch (InvalidDataTypeException $e) {
        $message = 'Custom tag support is not enabled. Enable the `Yaml::PARSE_CUSTOM_TAGS` flag to prevent the %s exception.';
        $this->fail(sprintf($message, InvalidDataTypeException::class));
    }
}

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