| @@ 486-498 (lines=13) @@ | ||
| 483 | ), $data['subWithoutIdentifier']); |
|
| 484 | } |
|
| 485 | ||
| 486 | public function testNestedTransformHandlesSingleObjects() |
|
| 487 | { |
|
| 488 | $transformer = $this->getTransformer(); |
|
| 489 | $document = $transformer->transform(new POPO(), array( |
|
| 490 | 'upper' => array( |
|
| 491 | 'type' => 'nested', |
|
| 492 | 'properties' => array('name' => '~') |
|
| 493 | ) |
|
| 494 | )); |
|
| 495 | ||
| 496 | $data = $document->getData(); |
|
| 497 | $this->assertEquals('a random name', $data['upper']['name']); |
|
| 498 | } |
|
| 499 | ||
| 500 | public function testNestedTransformReturnsAnEmptyArrayForNullValues() |
|
| 501 | { |
|
| @@ 500-516 (lines=17) @@ | ||
| 497 | $this->assertEquals('a random name', $data['upper']['name']); |
|
| 498 | } |
|
| 499 | ||
| 500 | public function testNestedTransformReturnsAnEmptyArrayForNullValues() |
|
| 501 | { |
|
| 502 | $transformer = $this->getTransformer(); |
|
| 503 | $document = $transformer->transform(new POPO(), array( |
|
| 504 | 'nullValue' => array( |
|
| 505 | 'type' => 'nested', |
|
| 506 | 'properties' => array( |
|
| 507 | 'foo' => array(), |
|
| 508 | 'bar' => array() |
|
| 509 | ), |
|
| 510 | ) |
|
| 511 | )); |
|
| 512 | ||
| 513 | $data = $document->getData(); |
|
| 514 | $this->assertInternalType('array', $data['nullValue']); |
|
| 515 | $this->assertEmpty($data['nullValue']); |
|
| 516 | } |
|
| 517 | ||
| 518 | public function testUnmappedFieldValuesAreNormalisedToStrings() |
|
| 519 | { |
|