Code Duplication    Length = 23-25 lines in 2 locations

eZ/Publish/API/Repository/Tests/ObjectStateServiceTest.php 2 locations

@@ 480-504 (lines=25) @@
477
     * @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroups($offset)
478
     * @depends testLoadObjectStateGroups
479
     */
480
    public function testLoadObjectStateGroupsWithOffset()
481
    {
482
        $repository = $this->getRepository();
483
        $objectStateService = $repository->getObjectStateService();
484
485
        $this->createObjectStateGroups();
486
487
        $allObjectStateGroups = $objectStateService->loadObjectStateGroups();
488
489
        $existingGroupIdentifiers = $this->getGroupIdentifierMap($allObjectStateGroups);
490
491
        /* BEGIN: Use Case */
492
        $objectStateService = $repository->getObjectStateService();
493
494
        $loadedObjectStateGroups = $objectStateService->loadObjectStateGroups(2);
495
        /* END: Use Case */
496
497
        $this->assertInternalType('array', $loadedObjectStateGroups);
498
499
        $this->assertObjectsLoadedByIdentifiers(
500
            array_slice($existingGroupIdentifiers, 2),
501
            $loadedObjectStateGroups,
502
            'ObjectStateGroup'
503
        );
504
    }
505
506
    /**
507
     * Returns a map of the given object state groups.
@@ 531-553 (lines=23) @@
528
     * @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroups($offset, $limit)
529
     * @depends testLoadObjectStateGroupsWithOffset
530
     */
531
    public function testLoadObjectStateGroupsWithOffsetAndLimit()
532
    {
533
        $repository = $this->getRepository();
534
        $objectStateService = $repository->getObjectStateService();
535
536
        $allObjectStateGroups = $objectStateService->loadObjectStateGroups();
537
538
        $existingGroupIdentifiers = $this->getGroupIdentifierMap($allObjectStateGroups);
539
540
        /* BEGIN: Use Case */
541
        $objectStateService = $repository->getObjectStateService();
542
543
        $loadedObjectStateGroups = $objectStateService->loadObjectStateGroups(1, 2);
544
        /* END: Use Case */
545
546
        $this->assertInternalType('array', $loadedObjectStateGroups);
547
548
        $this->assertObjectsLoadedByIdentifiers(
549
            array_slice($existingGroupIdentifiers, 1, 2),
550
            $loadedObjectStateGroups,
551
            'ObjectStateGroup'
552
        );
553
    }
554
555
    /**
556
     * Test for the loadObjectStates() method.