Code Duplication    Length = 20-20 lines in 3 locations

eZ/Publish/API/Repository/Tests/LocationServiceTest.php 3 locations

@@ 685-704 (lines=20) @@
682
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationChildren()
683
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
684
     */
685
    public function testLoadLocationChildren()
686
    {
687
        $repository = $this->getRepository();
688
689
        $locationId = $this->generateId('location', 5);
690
        /* BEGIN: Use Case */
691
        // $locationId is the ID of an existing location
692
        $locationService = $repository->getLocationService();
693
694
        $location = $locationService->loadLocation($locationId);
695
696
        $childLocations = $locationService->loadLocationChildren($location);
697
        /* END: Use Case */
698
699
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationList', $childLocations);
700
        $this->assertInternalType('array', $childLocations->locations);
701
        $this->assertInternalType('int', $childLocations->totalCount);
702
703
        return $childLocations;
704
    }
705
706
    /**
707
     * Test for the getLocationChildCount() method.
@@ 768-787 (lines=20) @@
765
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationChildren($location, $offset)
766
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationChildren
767
     */
768
    public function testLoadLocationChildrenWithOffset()
769
    {
770
        $repository = $this->getRepository();
771
772
        $locationId = $this->generateId('location', 5);
773
        /* BEGIN: Use Case */
774
        // $locationId is the ID of an existing location
775
        $locationService = $repository->getLocationService();
776
777
        $location = $locationService->loadLocation($locationId);
778
779
        $childLocations = $locationService->loadLocationChildren($location, 2);
780
        /* END: Use Case */
781
782
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationList', $childLocations);
783
        $this->assertInternalType('array', $childLocations->locations);
784
        $this->assertInternalType('int', $childLocations->totalCount);
785
786
        return $childLocations;
787
    }
788
789
    /**
790
     * Test for the loadLocationChildren() method.
@@ 832-851 (lines=20) @@
829
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationChildren($location, $offset, $limit)
830
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationChildren
831
     */
832
    public function testLoadLocationChildrenWithOffsetAndLimit()
833
    {
834
        $repository = $this->getRepository();
835
836
        $locationId = $this->generateId('location', 5);
837
        /* BEGIN: Use Case */
838
        // $locationId is the ID of an existing location
839
        $locationService = $repository->getLocationService();
840
841
        $location = $locationService->loadLocation($locationId);
842
843
        $childLocations = $locationService->loadLocationChildren($location, 2, 2);
844
        /* END: Use Case */
845
846
        $this->assertInstanceOf('\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationList', $childLocations);
847
        $this->assertInternalType('array', $childLocations->locations);
848
        $this->assertInternalType('int', $childLocations->totalCount);
849
850
        return $childLocations;
851
    }
852
853
    /**
854
     * Test for the loadLocationChildren() method.