Code Duplication    Length = 15-21 lines in 3 locations

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

@@ 38-58 (lines=21) @@
35
     *
36
     * @see \eZ\Publish\API\Repository\LocationService::newLocationCreateStruct()
37
     */
38
    public function testNewLocationCreateStruct()
39
    {
40
        $repository = $this->getRepository();
41
42
        $parentLocationId = $this->generateId('location', 1);
43
        /* BEGIN: Use Case */
44
        // $parentLocationId is the ID of an existing location
45
        $locationService = $repository->getLocationService();
46
47
        $locationCreate = $locationService->newLocationCreateStruct(
48
            $parentLocationId
49
        );
50
        /* END: Use Case */
51
52
        $this->assertInstanceOf(
53
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct',
54
            $locationCreate
55
        );
56
57
        return $locationCreate;
58
    }
59
60
    /**
61
     * Test for the newLocationCreateStruct() method.
@@ 563-577 (lines=15) @@
560
     * @see \eZ\Publish\API\Repository\LocationService::loadLocation()
561
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testCreateLocation
562
     */
563
    public function testLoadLocationThrowsNotFoundException()
564
    {
565
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class);
566
567
        $repository = $this->getRepository();
568
569
        $nonExistentLocationId = $this->generateId('location', 2342);
570
        /* BEGIN: Use Case */
571
        $locationService = $repository->getLocationService();
572
573
        // Throws exception, if Location with $nonExistentLocationId does not
574
        // exist
575
        $location = $locationService->loadLocation($nonExistentLocationId);
576
        /* END: Use Case */
577
    }
578
579
    /**
580
     * Test for the loadLocationList() method.
@@ 668-684 (lines=17) @@
665
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
666
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
667
     */
668
    public function testLoadLocationByRemoteId()
669
    {
670
        $repository = $this->getRepository();
671
672
        /* BEGIN: Use Case */
673
        $locationService = $repository->getLocationService();
674
675
        $location = $locationService->loadLocationByRemoteId(
676
            '3f6d92f8044aed134f32153517850f5a'
677
        );
678
        /* END: Use Case */
679
680
        $this->assertEquals(
681
            $locationService->loadLocation($this->generateId('location', 5)),
682
            $location
683
        );
684
    }
685
686
    /**
687
     * Test for the loadLocationByRemoteId() method.