class YamlTest in Zircon Profile 8
Same name in this branch
- 8 vendor/symfony/yaml/Tests/YamlTest.php \Symfony\Component\Yaml\Tests\YamlTest
- 8 core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Component/Serialization/YamlTest.php \Drupal\Tests\Component\Serialization\YamlTest
@coversDefaultClass \Drupal\Component\Serialization\Yaml @group Serialization
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Component\Serialization\YamlTest
Expanded class hierarchy of YamlTest
File
- core/
tests/ Drupal/ Tests/ Component/ Serialization/ YamlTest.php, line 17 - Contains \Drupal\Tests\Component\Serialization\YamlTest.
Namespace
Drupal\Tests\Component\SerializationView source
class YamlTest extends UnitTestCase {
/**
* @covers ::decode
*/
public function testDecode() {
// Test that files without line break endings are properly interpreted.
$yaml = 'foo: bar';
$expected = array(
'foo' => 'bar',
);
$this
->assertSame($expected, Yaml::decode($yaml));
$yaml .= "\n";
$this
->assertSame($expected, Yaml::decode($yaml));
$yaml .= "\n";
$this
->assertSame($expected, Yaml::decode($yaml));
$yaml = "{}\n";
$expected = array();
$this
->assertSame($expected, Yaml::decode($yaml));
$yaml = '';
$this
->assertNULL(Yaml::decode($yaml));
$yaml .= "\n";
$this
->assertNULL(Yaml::decode($yaml));
$yaml .= "\n";
$this
->assertNULL(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());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 259 | |
YamlTest:: |
public | function | @covers ::decode | |
YamlTest:: |
public | function | @covers ::encode | |
YamlTest:: |
public | function | @covers ::getFileExtension |