Code Duplication    Length = 15-21 lines in 3 locations

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

@@ 39-59 (lines=21) @@
36
     *
37
     * @see \eZ\Publish\API\Repository\LocationService::newLocationCreateStruct()
38
     */
39
    public function testNewLocationCreateStruct()
40
    {
41
        $repository = $this->getRepository();
42
43
        $parentLocationId = $this->generateId('location', 1);
44
        /* BEGIN: Use Case */
45
        // $parentLocationId is the ID of an existing location
46
        $locationService = $repository->getLocationService();
47
48
        $locationCreate = $locationService->newLocationCreateStruct(
49
            $parentLocationId
50
        );
51
        /* END: Use Case */
52
53
        $this->assertInstanceOf(
54
            '\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct',
55
            $locationCreate
56
        );
57
58
        return $locationCreate;
59
    }
60
61
    /**
62
     * Test for the newLocationCreateStruct() method.
@@ 564-578 (lines=15) @@
561
     * @see \eZ\Publish\API\Repository\LocationService::loadLocation()
562
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testCreateLocation
563
     */
564
    public function testLoadLocationThrowsNotFoundException()
565
    {
566
        $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class);
567
568
        $repository = $this->getRepository();
569
570
        $nonExistentLocationId = $this->generateId('location', 2342);
571
        /* BEGIN: Use Case */
572
        $locationService = $repository->getLocationService();
573
574
        // Throws exception, if Location with $nonExistentLocationId does not
575
        // exist
576
        $location = $locationService->loadLocation($nonExistentLocationId);
577
        /* END: Use Case */
578
    }
579
580
    /**
581
     * Test for the loadLocationList() method.
@@ 693-709 (lines=17) @@
690
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
691
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
692
     */
693
    public function testLoadLocationByRemoteId()
694
    {
695
        $repository = $this->getRepository();
696
697
        /* BEGIN: Use Case */
698
        $locationService = $repository->getLocationService();
699
700
        $location = $locationService->loadLocationByRemoteId(
701
            '3f6d92f8044aed134f32153517850f5a'
702
        );
703
        /* END: Use Case */
704
705
        $this->assertEquals(
706
            $locationService->loadLocation($this->generateId('location', 5)),
707
            $location
708
        );
709
    }
710
711
    /**
712
     * Test for the loadLocationByRemoteId() method.