Update v1.0.6.5

This commit is contained in:
sujitprasad
2016-03-02 12:25:21 +05:30
parent 7011553462
commit c56ff86194
218 changed files with 17161 additions and 2358 deletions

View File

@@ -754,7 +754,7 @@ yaml: |
Billsmer @ 338-4338.
php: |
array(
'invoice' => 34843, 'date' => mktime(0, 0, 0, 1, 23, 2001),
'invoice' => 34843, 'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'bill-to' =>
array( 'given' => 'Chris', 'family' => 'Dumars', 'address' => array( 'lines' => "458 Walkman Dr.\nSuite #292\n", 'city' => 'Royal Oak', 'state' => 'MI', 'postal' => 48046 ) )
, 'ship-to' =>
@@ -879,7 +879,7 @@ yaml: |
php: |
array(
'invoice' => 34843,
'date' => mktime(0, 0, 0, 1, 23, 2001),
'date' => gmmktime(0, 0, 0, 1, 23, 2001),
'total' => 4443.52
)
---

View File

@@ -251,7 +251,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
array("'on'", 'on'),
array("'off'", 'off'),
array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),
@@ -318,7 +318,7 @@ class InlineTest extends \PHPUnit_Framework_TestCase
array("'#cfcfcf'", '#cfcfcf'),
array('::form_base.html.twig', '::form_base.html.twig'),
array('2007-10-30', mktime(0, 0, 0, 10, 30, 2007)),
array('2007-10-30', gmmktime(0, 0, 0, 10, 30, 2007)),
array('2007-10-30T02:59:43Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('2007-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 2007)),
array('1960-10-30 02:59:43 Z', gmmktime(2, 59, 43, 10, 30, 1960)),

View File

@@ -442,35 +442,75 @@ EOF;
$this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects');
}
public function testObjectForMapEnabledWithMapping()
/**
* @dataProvider getObjectForMapTests
*/
public function testObjectForMap($yaml, $expected)
{
$this->assertEquals($expected, $this->parser->parse($yaml, false, false, true));
}
public function getObjectForMapTests()
{
$tests = array();
$yaml = <<<EOF
foo:
fiz: [cat]
EOF;
$result = $this->parser->parse($yaml, false, false, true);
$expected = new \stdClass();
$expected->foo = new \stdClass();
$expected->foo->fiz = array('cat');
$tests['mapping'] = array($yaml, $expected);
$this->assertInstanceOf('stdClass', $result);
$this->assertInstanceOf('stdClass', $result->foo);
$this->assertEquals(array('cat'), $result->foo->fiz);
}
$yaml = '{ "foo": "bar", "fiz": "cat" }';
$expected = new \stdClass();
$expected->foo = 'bar';
$expected->fiz = 'cat';
$tests['inline-mapping'] = array($yaml, $expected);
public function testObjectForMapEnabledWithInlineMapping()
{
$result = $this->parser->parse('{ "foo": "bar", "fiz": "cat" }', false, false, true);
$this->assertInstanceOf('stdClass', $result);
$this->assertEquals('bar', $result->foo);
$this->assertEquals('cat', $result->fiz);
}
public function testObjectForMapIsAppliedAfterParsing()
{
$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);
$this->assertEquals($expected, $this->parser->parse("foo: bar\nbaz: foobar", false, false, true));
$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;
}
/**