Code Duplication    Length = 20-20 lines in 3 locations

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

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