Code Duplication    Length = 67-69 lines in 2 locations

Tests/Units/UnitOfWork.php 2 locations

@@ 219-285 (lines=67) @@
216
        ;
217
    }
218
219
    public function testNoChanges()
220
    {
221
        $mapping = $this->getMapping();
222
        $unitOfWork = $this->newTestedInstance($mapping);
223
224
        $this
225
            ->given($newSerializedModel = [
226
                '@id' => '/v12/carts/1',
227
                'cartItemList' => [
228
                    '/v12/cart_items/1',
229
                    '/v12/cart_items/2',
230
                    '/v12/cart_items/3',
231
                ],
232
            ])
233
            ->then
234
                ->variable($unitOfWork->getDirtyData(
235
                    $newSerializedModel,
236
                    [
237
                        '@id' => '/v12/carts/1',
238
                        'cartItemList' => [
239
                            '/v12/cart_items/1',
240
                            '/v12/cart_items/2',
241
                            '/v12/cart_items/3',
242
                        ],
243
                    ],
244
                    $this->getCartMetadata()
245
                ))
246
                ->isEqualTo(
247
                    [
248
                    ]
249
                )
250
            ->then
251
                ->variable($unitOfWork->getDirtyData(
252
                    [
253
                        '@id' => '/v12/carts/1',
254
                        'cartItemList' => [
255
                            [
256
                                '@id' => '/v12/cart_items/1',
257
                                'amount' => 1,
258
                            ],
259
                            [
260
                                '@id' => '/v12/cart_items/2',
261
                                'amount' => 1,
262
                            ],
263
                        ],
264
                    ],
265
                    [
266
                        '@id' => '/v12/carts/1',
267
                        'cartItemList' => [
268
                            [
269
                                '@id' => '/v12/cart_items/1',
270
                                'amount' => 1,
271
                            ],
272
                            [
273
                                '@id' => '/v12/cart_items/2',
274
                                'amount' => 1,
275
                            ],
276
                        ],
277
                    ],
278
                    $this->getCartMetadata()
279
                ))
280
                ->isEqualTo(
281
                    [
282
                    ]
283
                )
284
        ;
285
    }
286
287
    public function testNoMetadata()
288
    {
@@ 287-355 (lines=69) @@
284
        ;
285
    }
286
287
    public function testNoMetadata()
288
    {
289
        $mapping = $this->getMapping();
290
        $unitOfWork = $this->newTestedInstance($mapping);
291
292
        $this
293
            ->given($newSerializedModel = [
294
                '@id' => '/v12/carts/1',
295
                'cartInfo' => [
296
                    [
297
                        'firstname' => 'john',
298
                        'lastname' => 'doe',
299
                    ],
300
                ],
301
            ])
302
            ->then
303
                ->variable($unitOfWork->getDirtyData(
304
                    $newSerializedModel,
305
                    [
306
                        '@id' => '/v12/carts/1',
307
                        'cartInfo' => [
308
                            [
309
                                'firstname' => 'john',
310
                                'lastname' => 'doe',
311
                            ],
312
                        ],
313
                    ],
314
                    $this->getCartMetadata()
315
                ))
316
                ->isEqualTo(
317
                    [
318
                    ]
319
                )
320
            ->then
321
                ->variable($unitOfWork->getDirtyData(
322
                    [
323
                        '@id' => '/v12/carts/1',
324
                        'cartItemList' => [
325
                            [
326
                                '@id' => '/v12/cart_items/1',
327
                                'amount' => 1,
328
                            ],
329
                            [
330
                                '@id' => '/v12/cart_items/2',
331
                                'amount' => 1,
332
                            ],
333
                        ],
334
                    ],
335
                    [
336
                        '@id' => '/v12/carts/1',
337
                        'cartItemList' => [
338
                            [
339
                                '@id' => '/v12/cart_items/1',
340
                                'amount' => 1,
341
                            ],
342
                            [
343
                                '@id' => '/v12/cart_items/2',
344
                                'amount' => 1,
345
                            ],
346
                        ],
347
                    ],
348
                    $this->getCartMetadata()
349
                ))
350
                ->isEqualTo(
351
                    [
352
                    ]
353
                )
354
        ;
355
    }
356
357
    public function testRemoveItem()
358
    {