| @@ 39-105 (lines=67) @@ | ||
| 36 | ; |
|
| 37 | } |
|
| 38 | ||
| 39 | public function testNoChanges() |
|
| 40 | { |
|
| 41 | $mapping = $this->getMapping(); |
|
| 42 | $unitOfWork = $this->newTestedInstance($mapping); |
|
| 43 | ||
| 44 | $this |
|
| 45 | ->given($newSerializedModel = [ |
|
| 46 | '@id' => '/v12/carts/1', |
|
| 47 | 'cartItemList' => [ |
|
| 48 | '/v12/cart_items/1', |
|
| 49 | '/v12/cart_items/2', |
|
| 50 | '/v12/cart_items/3', |
|
| 51 | ], |
|
| 52 | ]) |
|
| 53 | ->then |
|
| 54 | ->variable($unitOfWork->getDirtyData( |
|
| 55 | $newSerializedModel, |
|
| 56 | [ |
|
| 57 | '@id' => '/v12/carts/1', |
|
| 58 | 'cartItemList' => [ |
|
| 59 | '/v12/cart_items/1', |
|
| 60 | '/v12/cart_items/2', |
|
| 61 | '/v12/cart_items/3', |
|
| 62 | ], |
|
| 63 | ], |
|
| 64 | $this->getCartMetadata() |
|
| 65 | )) |
|
| 66 | ->isEqualTo( |
|
| 67 | [ |
|
| 68 | ] |
|
| 69 | ) |
|
| 70 | ->then |
|
| 71 | ->variable($unitOfWork->getDirtyData( |
|
| 72 | [ |
|
| 73 | '@id' => '/v12/carts/1', |
|
| 74 | 'cartItemList' => [ |
|
| 75 | [ |
|
| 76 | '@id' => '/v12/cart_items/1', |
|
| 77 | 'amount' => 1, |
|
| 78 | ], |
|
| 79 | [ |
|
| 80 | '@id' => '/v12/cart_items/2', |
|
| 81 | 'amount' => 1, |
|
| 82 | ], |
|
| 83 | ], |
|
| 84 | ], |
|
| 85 | [ |
|
| 86 | '@id' => '/v12/carts/1', |
|
| 87 | 'cartItemList' => [ |
|
| 88 | [ |
|
| 89 | '@id' => '/v12/cart_items/1', |
|
| 90 | 'amount' => 1, |
|
| 91 | ], |
|
| 92 | [ |
|
| 93 | '@id' => '/v12/cart_items/2', |
|
| 94 | 'amount' => 1, |
|
| 95 | ], |
|
| 96 | ], |
|
| 97 | ], |
|
| 98 | $this->getCartMetadata() |
|
| 99 | )) |
|
| 100 | ->isEqualTo( |
|
| 101 | [ |
|
| 102 | ] |
|
| 103 | ) |
|
| 104 | ; |
|
| 105 | } |
|
| 106 | ||
| 107 | public function testNoMetadata() |
|
| 108 | { |
|
| @@ 107-175 (lines=69) @@ | ||
| 104 | ; |
|
| 105 | } |
|
| 106 | ||
| 107 | public function testNoMetadata() |
|
| 108 | { |
|
| 109 | $mapping = $this->getMapping(); |
|
| 110 | $unitOfWork = $this->newTestedInstance($mapping); |
|
| 111 | ||
| 112 | $this |
|
| 113 | ->given($newSerializedModel = [ |
|
| 114 | '@id' => '/v12/carts/1', |
|
| 115 | 'cartInfo' => [ |
|
| 116 | [ |
|
| 117 | 'firstname' => 'john', |
|
| 118 | 'lastname' => 'doe', |
|
| 119 | ], |
|
| 120 | ], |
|
| 121 | ]) |
|
| 122 | ->then |
|
| 123 | ->variable($unitOfWork->getDirtyData( |
|
| 124 | $newSerializedModel, |
|
| 125 | [ |
|
| 126 | '@id' => '/v12/carts/1', |
|
| 127 | 'cartInfo' => [ |
|
| 128 | [ |
|
| 129 | 'firstname' => 'john', |
|
| 130 | 'lastname' => 'doe', |
|
| 131 | ], |
|
| 132 | ], |
|
| 133 | ], |
|
| 134 | $this->getCartMetadata() |
|
| 135 | )) |
|
| 136 | ->isEqualTo( |
|
| 137 | [ |
|
| 138 | ] |
|
| 139 | ) |
|
| 140 | ->then |
|
| 141 | ->variable($unitOfWork->getDirtyData( |
|
| 142 | [ |
|
| 143 | '@id' => '/v12/carts/1', |
|
| 144 | 'cartItemList' => [ |
|
| 145 | [ |
|
| 146 | '@id' => '/v12/cart_items/1', |
|
| 147 | 'amount' => 1, |
|
| 148 | ], |
|
| 149 | [ |
|
| 150 | '@id' => '/v12/cart_items/2', |
|
| 151 | 'amount' => 1, |
|
| 152 | ], |
|
| 153 | ], |
|
| 154 | ], |
|
| 155 | [ |
|
| 156 | '@id' => '/v12/carts/1', |
|
| 157 | 'cartItemList' => [ |
|
| 158 | [ |
|
| 159 | '@id' => '/v12/cart_items/1', |
|
| 160 | 'amount' => 1, |
|
| 161 | ], |
|
| 162 | [ |
|
| 163 | '@id' => '/v12/cart_items/2', |
|
| 164 | 'amount' => 1, |
|
| 165 | ], |
|
| 166 | ], |
|
| 167 | ], |
|
| 168 | $this->getCartMetadata() |
|
| 169 | )) |
|
| 170 | ->isEqualTo( |
|
| 171 | [ |
|
| 172 | ] |
|
| 173 | ) |
|
| 174 | ; |
|
| 175 | } |
|
| 176 | ||
| 177 | public function testRemoveItem() |
|
| 178 | { |
|