function YamlTest::testGetSeralization

Test that the overridden serializer is called.

@covers ::getSerializer @runInSeparateProcess

File

core/tests/Drupal/Tests/Core/Serialization/YamlTest.php, line 22

Class

YamlTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Serialization%21Yaml.php/class/Yaml/8.9.x" title="Provides a YAML serialization implementation." class="local">\Drupal\Core\Serialization\Yaml</a> @group Serialization

Namespace

Drupal\Tests\Core\Serialization

Code

public function testGetSeralization() {
    new Settings([
        'yaml_parser_class' => YamlParserProxy::class,
    ]);
    $this->assertEquals(YamlParserProxy::class, Settings::get('yaml_parser_class'));
    $mock = $this->getMockBuilder('\\stdClass')
        ->setMethods([
        'encode',
        'decode',
        'getFileExtension',
    ])
        ->getMock();
    $mock->expects($this->once())
        ->method('decode');
    YamlParserProxy::setMock($mock);
    Yaml::decode('---');
    new Settings([]);
}

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