| @@ 241-253 (lines=13) @@ | ||
| 238 | $this->assertSame(['value1'], $data['iterator']); |
|
| 239 | } |
|
| 240 | ||
| 241 | public function testThatCanTransformObjectWithArrayValue() |
|
| 242 | { |
|
| 243 | $transformer = $this->getTransformer(); |
|
| 244 | $document = $transformer->transform(new POPO(), ['array' => []]); |
|
| 245 | $data = $document->getData(); |
|
| 246 | ||
| 247 | $this->assertSame( |
|
| 248 | [ |
|
| 249 | 'key1' => 'value1', |
|
| 250 | 'key2' => 'value2', |
|
| 251 | ], $data['array'] |
|
| 252 | ); |
|
| 253 | } |
|
| 254 | ||
| 255 | public function testThatCanTransformObjectWithMultiDimensionalArrayValue() |
|
| 256 | { |
|
| @@ 495-507 (lines=13) @@ | ||
| 492 | ], $data['subWithoutIdentifier']); |
|
| 493 | } |
|
| 494 | ||
| 495 | public function testNestedTransformHandlesSingleObjects() |
|
| 496 | { |
|
| 497 | $transformer = $this->getTransformer(); |
|
| 498 | $document = $transformer->transform(new POPO(), [ |
|
| 499 | 'upper' => [ |
|
| 500 | 'type' => 'nested', |
|
| 501 | 'properties' => ['name' => null], |
|
| 502 | ], |
|
| 503 | ]); |
|
| 504 | ||
| 505 | $data = $document->getData(); |
|
| 506 | $this->assertSame('a random name', $data['upper']['name']); |
|
| 507 | } |
|
| 508 | ||
| 509 | public function testNestedTransformReturnsAnEmptyArrayForNullValues() |
|
| 510 | { |
|