@@ 188-217 (lines=30) @@ | ||
185 | ; |
|
186 | } |
|
187 | ||
188 | public function testSerializeThreeLevel() |
|
189 | { |
|
190 | $this->createNewInstance(); |
|
191 | ||
192 | $this |
|
193 | ->given($cart = $this->createNewCart()) |
|
194 | ->and($cartItem = $this->createNewCartItem()) |
|
195 | ->and($cart->addCartItemList($cartItem)) |
|
196 | ->then |
|
197 | ->array($data = $this->testedInstance->serialize($cart, 'Mapado\RestClientSdk\Tests\Model\Cart')) |
|
198 | ->isIdenticalTo([ |
|
199 | 'status' => 'payed', |
|
200 | 'clientPhoneNumber' => '+33 1 23 45 67 89', |
|
201 | 'createdAt' => (new \DateTime('2015-09-20T12:08:00'))->format(DateTime::RFC3339), |
|
202 | 'cart_items' => [ |
|
203 | [ |
|
204 | 'amount' => 2, |
|
205 | 'createdAt' => (new \DateTime('2015-09-20T12:11:00'))->format(DateTime::RFC3339), |
|
206 | 'data' => [ |
|
207 | 'when' => (new \DateTime('2015-09-20T15:00:00'))->format(DateTime::RFC3339), |
|
208 | 'who' => 'John', |
|
209 | ], |
|
210 | 'product' => '/v1/products/10', |
|
211 | 'cartItemDetailList' => [], |
|
212 | ], |
|
213 | ], |
|
214 | 'order' => null, |
|
215 | ]) |
|
216 | ; |
|
217 | } |
|
218 | ||
219 | /** |
|
220 | * testJsonEncodeRelationWithoutLinkMultipleLevel |
|
@@ 356-385 (lines=30) @@ | ||
353 | * @access public |
|
354 | * @return void |
|
355 | */ |
|
356 | public function testMultipleLevelSerialization() |
|
357 | { |
|
358 | $this->createNewInstance(); |
|
359 | $this |
|
360 | ->given($cart = $this->createNewCart()) |
|
361 | ->and($cartItem = $this->createNewCartItem()) |
|
362 | ->and($cartItem->setCart($cart)) |
|
363 | ->then |
|
364 | ->array($this->testedInstance->serialize($cart, 'Mapado\RestClientSdk\Tests\Model\Cart')) |
|
365 | ->isIdenticalTo([ |
|
366 | 'status' => 'payed', |
|
367 | 'clientPhoneNumber' => '+33 1 23 45 67 89', |
|
368 | 'createdAt' => (new \DateTime('2015-09-20T12:08:00'))->format(DateTime::RFC3339), |
|
369 | 'cart_items' => [ |
|
370 | [ |
|
371 | 'amount' => 2, |
|
372 | 'createdAt' => (new \DateTime('2015-09-20T12:11:00'))->format(DateTime::RFC3339), |
|
373 | 'data' => [ |
|
374 | 'when' => (new \DateTime('2015-09-20T15:00:00'))->format(DateTime::RFC3339), |
|
375 | 'who' => 'John', |
|
376 | ], |
|
377 | 'product' => '/v1/products/10', |
|
378 | 'cartItemDetailList' => [], |
|
379 | ], |
|
380 | ], |
|
381 | 'order' => null, |
|
382 | ]) |
|
383 | ||
384 | ; |
|
385 | } |
|
386 | ||
387 | /** |
|
388 | * testLinkedUnserialize |