Code Duplication    Length = 23-25 lines in 2 locations

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

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