public function YamlTest::testGetSerialization in Drupal 9
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')
->setMethods([
'encode',
'decode',
'getFileExtension',
])
->getMock();
$mock
->expects($this
->once())
->method('decode');
YamlParserProxy::setMock($mock);
Yaml::decode('---');
new Settings([]);
}