function YamlTest::testGetSerialization
Tests that the overridden serializer is called.
@covers ::getSerializer @runInSeparateProcess
File
-
core/
tests/ Drupal/ Tests/ Core/ Serialization/ YamlTest.php, line 22
Class
- YamlTest
- @coversDefaultClass \Drupal\Core\Serialization\Yaml @group Serialization
Namespace
Drupal\Tests\Core\SerializationCode
public function testGetSerialization() {
new Settings([
'yaml_parser_class' => YamlParserProxy::class,
]);
$this->assertEquals(YamlParserProxy::class, Settings::get('yaml_parser_class'));
$mock = $this->getMockBuilder('\\stdClass')
->addMethods([
'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.