public function YamlTest::testGetSeralization in Drupal 8
Test 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 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([]);
}