You are here

public function DumperTest::testSpecifications in Lockr 7.3

File

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

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']);
      }
    }
  }
}