You are here

public function DumperTest::testSpecifications in Loft Data Grids 7.2

Same name and namespace in other branches
  1. 6.2 vendor/symfony/yaml/Symfony/Component/Yaml/Tests/DumperTest.php \Symfony\Component\Yaml\Tests\DumperTest::testSpecifications()

File

vendor/symfony/yaml/Tests/DumperTest.php, line 80

Class

DumperTest

Namespace

Symfony\Component\Yaml\Tests

Code

public function testSpecifications() {
  $files = $this->parser
    ->parse(file_get_contents($this->path . '/index.yml'));
  foreach ($files as $file) {
    $yamls = file_get_contents($this->path . '/' . $file . '.yml');

    // split YAMLs documents
    foreach (preg_split('/^---( %YAML\\:1\\.0)?/m', $yamls) as $yaml) {
      if (!$yaml) {
        continue;
      }
      $test = $this->parser
        ->parse($yaml);
      if (isset($test['dump_skip']) && $test['dump_skip']) {
        continue;
      }
      elseif (isset($test['todo']) && $test['todo']) {

        // TODO
      }
      else {
        eval('$expected = ' . trim($test['php']) . ';');
        $this
          ->assertSame($expected, $this->parser
          ->parse($this->dumper
          ->dump($expected, 10)), $test['test']);
      }
    }
  }
}