Example #1
0
 public function getDataFormSpecifications()
 {
     $parser = new Parser();
     $path = __DIR__ . '/Fixtures';
     $tests = array();
     $files = $parser->parse(file_get_contents($path . '/index.yml'));
     foreach ($files as $file) {
         $yamls = file_get_contents($path . '/' . $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 {
                 $expected = var_export(eval('return ' . trim($test['php']) . ';'), true);
                 $tests[] = array($expected, $test['yaml'], $test['test']);
             }
         }
     }
     return $tests;
 }
Example #2
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Parser;
use Symfony\Components\Yaml\ParserException;
Yaml::setSpecVersion('1.1');
$t = new LimeTest(148);
$parser = new Parser();
$path = __DIR__ . '/../../../../fixtures/Symfony/Components/Yaml';
$files = $parser->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
    $t->diag($file);
    $yamls = file_get_contents($path . '/' . $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']) {
            $t->todo($test['test']);
        } else {
            $expected = var_export(eval('return ' . trim($test['php']) . ';'), true);
Example #3
0
<?php

/*
 * This file is part of the symfony package.
 * (c) Fabien Potencier <*****@*****.**>
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../../../bootstrap.php';
use Symfony\Components\Yaml\Yaml;
use Symfony\Components\Yaml\Parser;
use Symfony\Components\Yaml\Dumper;
Yaml::setSpecVersion('1.1');
$t = new LimeTest(150);
$parser = new Parser();
$dumper = new Dumper();
$path = __DIR__ . '/../../../../fixtures/Symfony/Components/Yaml';
$files = $parser->parse(file_get_contents($path . '/index.yml'));
foreach ($files as $file) {
    $t->diag($file);
    $yamls = file_get_contents($path . '/' . $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['dump_skip']) && $test['dump_skip']) {
            continue;
        } else {