diff --git a/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php b/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php index 5b62289..2b155cb 100644 --- a/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php +++ b/core/tests/Drupal/Tests/Core/Serialization/YamlTest.php @@ -128,4 +128,33 @@ public function providerYamlNodeAnchors() { return $data; } + /** + * Tests all YAML files are decoded in the same way with both Symfony and PECL. + * + * @dataProvider providerYamlFilesInCore + */ + public function testYamlFilesInCore($file) { + $data = file_get_contents($file); + $symfony = new YamlSymfony(); + $pecl = new YamlPecl(); + $this->assertEquals($symfony->decode($data), $pecl->decode($data)); + } + + /** + * Data provider for YAML files in core test. + * @return array + */ + public function providerYamlFilesInCore() { + $files = array(); + $dirs = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . '/../../../../../', \RecursiveDirectoryIterator::FOLLOW_SYMLINKS)); + foreach ($dirs as $dir) { + $pathname = $dir->getPathname(); + // Exclude vendor. + if ($dir->getExtension() == 'yml' && strpos($pathname, '/../../../../../vendor') === FALSE) { + $files[] = array($dir->getRealPath()); + } + } + return $files; + } + }