| @@ 240-306 (lines=67) @@ | ||
| 237 | ; |
|
| 238 | } |
|
| 239 | ||
| 240 | public function testNoChanges() |
|
| 241 | { |
|
| 242 | $mapping = $this->getMapping(); |
|
| 243 | $unitOfWork = $this->newTestedInstance($mapping); |
|
| 244 | ||
| 245 | $this |
|
| 246 | ->given($newSerializedModel = [ |
|
| 247 | '@id' => '/v12/carts/1', |
|
| 248 | 'cartItemList' => [ |
|
| 249 | '/v12/cart_items/1', |
|
| 250 | '/v12/cart_items/2', |
|
| 251 | '/v12/cart_items/3', |
|
| 252 | ], |
|
| 253 | ]) |
|
| 254 | ->then |
|
| 255 | ->variable($unitOfWork->getDirtyData( |
|
| 256 | $newSerializedModel, |
|
| 257 | [ |
|
| 258 | '@id' => '/v12/carts/1', |
|
| 259 | 'cartItemList' => [ |
|
| 260 | '/v12/cart_items/1', |
|
| 261 | '/v12/cart_items/2', |
|
| 262 | '/v12/cart_items/3', |
|
| 263 | ], |
|
| 264 | ], |
|
| 265 | $this->getCartMetadata() |
|
| 266 | )) |
|
| 267 | ->isEqualTo( |
|
| 268 | [ |
|
| 269 | ] |
|
| 270 | ) |
|
| 271 | ->then |
|
| 272 | ->variable($unitOfWork->getDirtyData( |
|
| 273 | [ |
|
| 274 | '@id' => '/v12/carts/1', |
|
| 275 | 'cartItemList' => [ |
|
| 276 | [ |
|
| 277 | '@id' => '/v12/cart_items/1', |
|
| 278 | 'amount' => 1, |
|
| 279 | ], |
|
| 280 | [ |
|
| 281 | '@id' => '/v12/cart_items/2', |
|
| 282 | 'amount' => 1, |
|
| 283 | ], |
|
| 284 | ], |
|
| 285 | ], |
|
| 286 | [ |
|
| 287 | '@id' => '/v12/carts/1', |
|
| 288 | 'cartItemList' => [ |
|
| 289 | [ |
|
| 290 | '@id' => '/v12/cart_items/1', |
|
| 291 | 'amount' => 1, |
|
| 292 | ], |
|
| 293 | [ |
|
| 294 | '@id' => '/v12/cart_items/2', |
|
| 295 | 'amount' => 1, |
|
| 296 | ], |
|
| 297 | ], |
|
| 298 | ], |
|
| 299 | $this->getCartMetadata() |
|
| 300 | )) |
|
| 301 | ->isEqualTo( |
|
| 302 | [ |
|
| 303 | ] |
|
| 304 | ) |
|
| 305 | ; |
|
| 306 | } |
|
| 307 | ||
| 308 | public function testNoMetadata() |
|
| 309 | { |
|
| @@ 308-376 (lines=69) @@ | ||
| 305 | ; |
|
| 306 | } |
|
| 307 | ||
| 308 | public function testNoMetadata() |
|
| 309 | { |
|
| 310 | $mapping = $this->getMapping(); |
|
| 311 | $unitOfWork = $this->newTestedInstance($mapping); |
|
| 312 | ||
| 313 | $this |
|
| 314 | ->given($newSerializedModel = [ |
|
| 315 | '@id' => '/v12/carts/1', |
|
| 316 | 'cartInfo' => [ |
|
| 317 | [ |
|
| 318 | 'firstname' => 'john', |
|
| 319 | 'lastname' => 'doe', |
|
| 320 | ], |
|
| 321 | ], |
|
| 322 | ]) |
|
| 323 | ->then |
|
| 324 | ->variable($unitOfWork->getDirtyData( |
|
| 325 | $newSerializedModel, |
|
| 326 | [ |
|
| 327 | '@id' => '/v12/carts/1', |
|
| 328 | 'cartInfo' => [ |
|
| 329 | [ |
|
| 330 | 'firstname' => 'john', |
|
| 331 | 'lastname' => 'doe', |
|
| 332 | ], |
|
| 333 | ], |
|
| 334 | ], |
|
| 335 | $this->getCartMetadata() |
|
| 336 | )) |
|
| 337 | ->isEqualTo( |
|
| 338 | [ |
|
| 339 | ] |
|
| 340 | ) |
|
| 341 | ->then |
|
| 342 | ->variable($unitOfWork->getDirtyData( |
|
| 343 | [ |
|
| 344 | '@id' => '/v12/carts/1', |
|
| 345 | 'cartItemList' => [ |
|
| 346 | [ |
|
| 347 | '@id' => '/v12/cart_items/1', |
|
| 348 | 'amount' => 1, |
|
| 349 | ], |
|
| 350 | [ |
|
| 351 | '@id' => '/v12/cart_items/2', |
|
| 352 | 'amount' => 1, |
|
| 353 | ], |
|
| 354 | ], |
|
| 355 | ], |
|
| 356 | [ |
|
| 357 | '@id' => '/v12/carts/1', |
|
| 358 | 'cartItemList' => [ |
|
| 359 | [ |
|
| 360 | '@id' => '/v12/cart_items/1', |
|
| 361 | 'amount' => 1, |
|
| 362 | ], |
|
| 363 | [ |
|
| 364 | '@id' => '/v12/cart_items/2', |
|
| 365 | 'amount' => 1, |
|
| 366 | ], |
|
| 367 | ], |
|
| 368 | ], |
|
| 369 | $this->getCartMetadata() |
|
| 370 | )) |
|
| 371 | ->isEqualTo( |
|
| 372 | [ |
|
| 373 | ] |
|
| 374 | ) |
|
| 375 | ; |
|
| 376 | } |
|
| 377 | ||
| 378 | public function testRemoveItem() |
|
| 379 | { |
|