diff --git a/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php new file mode 100644 index 0000000..0677382 --- /dev/null +++ b/core/tests/Drupal/Tests/Component/Serialization/YamlTest.php @@ -0,0 +1,54 @@ + 'bar', + ); + $this->assertSame($expected, Yaml::decode($yaml)); + $yaml .= "\n"; + $this->assertSame($expected, Yaml::decode($yaml)); + + $yaml = "{}\n\n"; + $expected = array(); + $this->assertSame($expected, Yaml::decode($yaml)); + } + + /** + * @covers ::encode + */ + public function testEncode() { + $decoded = array( + 'foo' => 'bar', + ); + $this->assertSame('foo: bar' . "\n", Yaml::encode($decoded)); + } + + /** + * @covers ::getFileExtension + */ + public function testGetFileExtension() { + $this->assertEquals('yml', Yaml::getFileExtension()); + } + +}