Code Duplication    Length = 21-27 lines in 3 locations

src/Oro/Component/PhpUtils/Tests/Unit/ArrayUtilTest.php 3 locations

@@ 354-374 (lines=21) @@
351
        );
352
    }
353
354
    public function testSortByObject()
355
    {
356
        $obj1  = $this->createObject(['name' => '1', 'priority' => null]);
357
        $obj2  = $this->createObject(['name' => '2', 'priority' => 100]);
358
        $obj3  = $this->createObject(['name' => '3', 'priority' => 0]);
359
        $array = [
360
            $obj1,
361
            $obj2,
362
            $obj3,
363
        ];
364
365
        ArrayUtil::sortBy($array);
366
        $this->assertSame(
367
            [
368
                $obj1,
369
                $obj3,
370
                $obj2,
371
            ],
372
            $array
373
        );
374
    }
375
376
    public function testSortByObjectPath()
377
    {
@@ 404-430 (lines=27) @@
401
        );
402
    }
403
404
    public function testSortByClosure()
405
    {
406
        $obj1  = $this->createObject(['name' => '1', 'priority' => null]);
407
        $obj2  = $this->createObject(['name' => '2', 'priority' => 100]);
408
        $obj3  = $this->createObject(['name' => '3', 'priority' => 0]);
409
        $array = [
410
            $obj1,
411
            $obj2,
412
            $obj3,
413
        ];
414
415
        ArrayUtil::sortBy(
416
            $array,
417
            false,
418
            function ($item) {
419
                return $item->priority;
420
            }
421
        );
422
        $this->assertSame(
423
            [
424
                $obj1,
425
                $obj3,
426
                $obj2,
427
            ],
428
            $array
429
        );
430
    }
431
432
    public function testSortByCallable()
433
    {
@@ 432-456 (lines=25) @@
429
        );
430
    }
431
432
    public function testSortByCallable()
433
    {
434
        $obj1  = $this->createObject(['name' => '1', 'priority' => null]);
435
        $obj2  = $this->createObject(['name' => '2', 'priority' => 100]);
436
        $obj3  = $this->createObject(['name' => '3', 'priority' => 0]);
437
        $array = [
438
            $obj1,
439
            $obj2,
440
            $obj3,
441
        ];
442
443
        ArrayUtil::sortBy(
444
            $array,
445
            false,
446
            [$this, 'getObjectPriority']
447
        );
448
        $this->assertSame(
449
            [
450
                $obj1,
451
                $obj3,
452
                $obj2,
453
            ],
454
            $array
455
        );
456
    }
457
458
    /**
459
     * @dataProvider someProvider