Code Duplication    Length = 20-20 lines in 3 locations

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

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