public function ParserTest::getObjectForMapTests in Loft Data Grids 7.2
File
- vendor/
symfony/ yaml/ Tests/ ParserTest.php, line 471
Class
Namespace
Symfony\Component\Yaml\TestsCode
public function getObjectForMapTests() {
$tests = array();
$yaml = <<<'EOF'
foo:
fiz: [cat]
EOF;
$expected = new \stdClass();
$expected->foo = new \stdClass();
$expected->foo->fiz = array(
'cat',
);
$tests['mapping'] = array(
$yaml,
$expected,
);
$yaml = '{ "foo": "bar", "fiz": "cat" }';
$expected = new \stdClass();
$expected->foo = 'bar';
$expected->fiz = 'cat';
$tests['inline-mapping'] = array(
$yaml,
$expected,
);
$yaml = "foo: bar\nbaz: foobar";
$expected = new \stdClass();
$expected->foo = 'bar';
$expected->baz = 'foobar';
$tests['object-for-map-is-applied-after-parsing'] = array(
$yaml,
$expected,
);
$yaml = <<<'EOT'
array:
- key: one
- key: two
EOT;
$expected = new \stdClass();
$expected->array = array();
$expected->array[0] = new \stdClass();
$expected->array[0]->key = 'one';
$expected->array[1] = new \stdClass();
$expected->array[1]->key = 'two';
$tests['nest-map-and-sequence'] = array(
$yaml,
$expected,
);
$yaml = <<<'YAML'
map:
1: one
2: two
YAML;
$expected = new \stdClass();
$expected->map = new \stdClass();
$expected->map->{1} = 'one';
$expected->map->{2} = 'two';
$tests['numeric-keys'] = array(
$yaml,
$expected,
);
$yaml = <<<'YAML'
map:
0: one
1: two
YAML;
$expected = new \stdClass();
$expected->map = new \stdClass();
$expected->map->{0} = 'one';
$expected->map->{1} = 'two';
$tests['zero-indexed-numeric-keys'] = array(
$yaml,
$expected,
);
return $tests;
}