@@ 318-384 (lines=67) @@ | ||
315 | ; |
|
316 | } |
|
317 | ||
318 | public function testNoChanges() |
|
319 | { |
|
320 | $mapping = $this->getMapping(); |
|
321 | $unitOfWork = $this->newTestedInstance($mapping); |
|
322 | ||
323 | $this |
|
324 | ->given($newSerializedModel = [ |
|
325 | '@id' => '/v12/carts/1', |
|
326 | 'cartItemList' => [ |
|
327 | '/v12/cart_items/1', |
|
328 | '/v12/cart_items/2', |
|
329 | '/v12/cart_items/3', |
|
330 | ], |
|
331 | ]) |
|
332 | ->then |
|
333 | ->variable($unitOfWork->getDirtyData( |
|
334 | $newSerializedModel, |
|
335 | [ |
|
336 | '@id' => '/v12/carts/1', |
|
337 | 'cartItemList' => [ |
|
338 | '/v12/cart_items/1', |
|
339 | '/v12/cart_items/2', |
|
340 | '/v12/cart_items/3', |
|
341 | ], |
|
342 | ], |
|
343 | $this->getCartMetadata() |
|
344 | )) |
|
345 | ->isEqualTo( |
|
346 | [ |
|
347 | ] |
|
348 | ) |
|
349 | ->then |
|
350 | ->variable($unitOfWork->getDirtyData( |
|
351 | [ |
|
352 | '@id' => '/v12/carts/1', |
|
353 | 'cartItemList' => [ |
|
354 | [ |
|
355 | '@id' => '/v12/cart_items/1', |
|
356 | 'amount' => 1, |
|
357 | ], |
|
358 | [ |
|
359 | '@id' => '/v12/cart_items/2', |
|
360 | 'amount' => 1, |
|
361 | ], |
|
362 | ], |
|
363 | ], |
|
364 | [ |
|
365 | '@id' => '/v12/carts/1', |
|
366 | 'cartItemList' => [ |
|
367 | [ |
|
368 | '@id' => '/v12/cart_items/1', |
|
369 | 'amount' => 1, |
|
370 | ], |
|
371 | [ |
|
372 | '@id' => '/v12/cart_items/2', |
|
373 | 'amount' => 1, |
|
374 | ], |
|
375 | ], |
|
376 | ], |
|
377 | $this->getCartMetadata() |
|
378 | )) |
|
379 | ->isEqualTo( |
|
380 | [ |
|
381 | ] |
|
382 | ) |
|
383 | ; |
|
384 | } |
|
385 | ||
386 | public function testNoMetadata() |
|
387 | { |
|
@@ 386-454 (lines=69) @@ | ||
383 | ; |
|
384 | } |
|
385 | ||
386 | public function testNoMetadata() |
|
387 | { |
|
388 | $mapping = $this->getMapping(); |
|
389 | $unitOfWork = $this->newTestedInstance($mapping); |
|
390 | ||
391 | $this |
|
392 | ->given($newSerializedModel = [ |
|
393 | '@id' => '/v12/carts/1', |
|
394 | 'cartInfo' => [ |
|
395 | [ |
|
396 | 'firstname' => 'john', |
|
397 | 'lastname' => 'doe', |
|
398 | ], |
|
399 | ], |
|
400 | ]) |
|
401 | ->then |
|
402 | ->variable($unitOfWork->getDirtyData( |
|
403 | $newSerializedModel, |
|
404 | [ |
|
405 | '@id' => '/v12/carts/1', |
|
406 | 'cartInfo' => [ |
|
407 | [ |
|
408 | 'firstname' => 'john', |
|
409 | 'lastname' => 'doe', |
|
410 | ], |
|
411 | ], |
|
412 | ], |
|
413 | $this->getCartMetadata() |
|
414 | )) |
|
415 | ->isEqualTo( |
|
416 | [ |
|
417 | ] |
|
418 | ) |
|
419 | ->then |
|
420 | ->variable($unitOfWork->getDirtyData( |
|
421 | [ |
|
422 | '@id' => '/v12/carts/1', |
|
423 | 'cartItemList' => [ |
|
424 | [ |
|
425 | '@id' => '/v12/cart_items/1', |
|
426 | 'amount' => 1, |
|
427 | ], |
|
428 | [ |
|
429 | '@id' => '/v12/cart_items/2', |
|
430 | 'amount' => 1, |
|
431 | ], |
|
432 | ], |
|
433 | ], |
|
434 | [ |
|
435 | '@id' => '/v12/carts/1', |
|
436 | 'cartItemList' => [ |
|
437 | [ |
|
438 | '@id' => '/v12/cart_items/1', |
|
439 | 'amount' => 1, |
|
440 | ], |
|
441 | [ |
|
442 | '@id' => '/v12/cart_items/2', |
|
443 | 'amount' => 1, |
|
444 | ], |
|
445 | ], |
|
446 | ], |
|
447 | $this->getCartMetadata() |
|
448 | )) |
|
449 | ->isEqualTo( |
|
450 | [ |
|
451 | ] |
|
452 | ) |
|
453 | ; |
|
454 | } |
|
455 | ||
456 | public function testRemoveItem() |
|
457 | { |