|
@@ 445-456 (lines=12) @@
|
| 442 |
|
$this->assertEquals(array('foo' => null, 'bar' => 1), $this->parser->parse($input), '->parse() does not parse objects'); |
| 443 |
|
} |
| 444 |
|
|
| 445 |
|
public function testObjectForMapEnabledWithMapping() |
| 446 |
|
{ |
| 447 |
|
$yaml = <<<EOF |
| 448 |
|
foo: |
| 449 |
|
fiz: [cat] |
| 450 |
|
EOF; |
| 451 |
|
$result = $this->parser->parse($yaml, false, false, true); |
| 452 |
|
|
| 453 |
|
$this->assertInstanceOf('stdClass', $result); |
| 454 |
|
$this->assertInstanceOf('stdClass', $result->foo); |
| 455 |
|
$this->assertEquals(array('cat'), $result->foo->fiz); |
| 456 |
|
} |
| 457 |
|
|
| 458 |
|
public function testObjectForMapEnabledWithInlineMapping() |
| 459 |
|
{ |
|
@@ 458-465 (lines=8) @@
|
| 455 |
|
$this->assertEquals(array('cat'), $result->foo->fiz); |
| 456 |
|
} |
| 457 |
|
|
| 458 |
|
public function testObjectForMapEnabledWithInlineMapping() |
| 459 |
|
{ |
| 460 |
|
$result = $this->parser->parse('{ "foo": "bar", "fiz": "cat" }', false, false, true); |
| 461 |
|
|
| 462 |
|
$this->assertInstanceOf('stdClass', $result); |
| 463 |
|
$this->assertEquals('bar', $result->foo); |
| 464 |
|
$this->assertEquals('cat', $result->fiz); |
| 465 |
|
} |
| 466 |
|
|
| 467 |
|
public function testObjectForMapIsAppliedAfterParsing() |
| 468 |
|
{ |