You are here

private function ParserTest::loadTestsFromFixtureFiles in Lockr 7.3

3 calls to ParserTest::loadTestsFromFixtureFiles()
ParserTest::getDataFormSpecifications in vendor/symfony/yaml/Tests/ParserTest.php
ParserTest::getLegacyNonStringMappingKeysData in vendor/symfony/yaml/Tests/ParserTest.php
ParserTest::getNonStringMappingKeysData in vendor/symfony/yaml/Tests/ParserTest.php

File

vendor/symfony/yaml/Tests/ParserTest.php, line 1894

Class

ParserTest

Namespace

Symfony\Component\Yaml\Tests

Code

private function loadTestsFromFixtureFiles($testsFile) {
  $parser = new Parser();
  $tests = [];
  $files = $parser
    ->parseFile(__DIR__ . '/Fixtures/' . $testsFile);
  foreach ($files as $file) {
    $yamls = file_get_contents(__DIR__ . '/Fixtures/' . $file . '.yml');

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

        // TODO
      }
      else {
        eval('$expected = ' . trim($test['php']) . ';');
        $tests[] = [
          var_export($expected, true),
          $test['yaml'],
          $test['test'],
          isset($test['deprecated']) ? $test['deprecated'] : false,
        ];
      }
    }
  }
  return $tests;
}