Code Duplication    Length = 23-25 lines in 2 locations

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

@@ 471-495 (lines=25) @@
468
     * @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroups($offset)
469
     * @depends testLoadObjectStateGroups
470
     */
471
    public function testLoadObjectStateGroupsWithOffset()
472
    {
473
        $repository = $this->getRepository();
474
        $objectStateService = $repository->getObjectStateService();
475
476
        $this->createObjectStateGroups();
477
478
        $allObjectStateGroups = $objectStateService->loadObjectStateGroups();
479
480
        $existingGroupIdentifiers = $this->getGroupIdentifierMap($allObjectStateGroups);
481
482
        /* BEGIN: Use Case */
483
        $objectStateService = $repository->getObjectStateService();
484
485
        $loadedObjectStateGroups = $objectStateService->loadObjectStateGroups(2);
486
        /* END: Use Case */
487
488
        $this->assertInternalType('array', $loadedObjectStateGroups);
489
490
        $this->assertObjectsLoadedByIdentifiers(
491
            array_slice($existingGroupIdentifiers, 2),
492
            $loadedObjectStateGroups,
493
            'ObjectStateGroup'
494
        );
495
    }
496
497
    /**
498
     * Returns a map of the given object state groups.
@@ 521-543 (lines=23) @@
518
     * @see \eZ\Publish\API\Repository\ObjectStateService::loadObjectStateGroups($offset, $limit)
519
     * @depends testLoadObjectStateGroupsWithOffset
520
     */
521
    public function testLoadObjectStateGroupsWithOffsetAndLimit()
522
    {
523
        $repository = $this->getRepository();
524
        $objectStateService = $repository->getObjectStateService();
525
526
        $allObjectStateGroups = $objectStateService->loadObjectStateGroups();
527
528
        $existingGroupIdentifiers = $this->getGroupIdentifierMap($allObjectStateGroups);
529
530
        /* BEGIN: Use Case */
531
        $objectStateService = $repository->getObjectStateService();
532
533
        $loadedObjectStateGroups = $objectStateService->loadObjectStateGroups(1, 2);
534
        /* END: Use Case */
535
536
        $this->assertInternalType('array', $loadedObjectStateGroups);
537
538
        $this->assertObjectsLoadedByIdentifiers(
539
            array_slice($existingGroupIdentifiers, 1, 2),
540
            $loadedObjectStateGroups,
541
            'ObjectStateGroup'
542
        );
543
    }
544
545
    /**
546
     * Test for the loadObjectStates() method.