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