Code Duplication    Length = 17-21 lines in 3 locations

eZ/Publish/API/Repository/Tests/LocationServiceAuthorizationTest.php 1 location

@@ 130-147 (lines=18) @@
127
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
128
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
129
     */
130
    public function testLoadLocationThrowsUnauthorizedException()
131
    {
132
        $repository = $this->getRepository();
133
134
        $editorsGroupId = $this->generateId('group', 13);
135
136
        /* BEGIN: Use Case */
137
        $locationService = $repository->getLocationService();
138
139
        $user = $this->createUserVersion1();
140
141
        // Set current user to newly created user
142
        $repository->setCurrentUser($user);
143
144
        // This call will fail with an "UnauthorizedException"
145
        $locationService->loadLocation($editorsGroupId);
146
        /* END: Use Case */
147
    }
148
149
    /**
150
     * Test for the loadLocationList() method.

eZ/Publish/API/Repository/Tests/LocationServiceTest.php 2 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.
@@ 663-679 (lines=17) @@
660
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
661
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
662
     */
663
    public function testLoadLocationByRemoteId()
664
    {
665
        $repository = $this->getRepository();
666
667
        /* BEGIN: Use Case */
668
        $locationService = $repository->getLocationService();
669
670
        $location = $locationService->loadLocationByRemoteId(
671
            '3f6d92f8044aed134f32153517850f5a'
672
        );
673
        /* END: Use Case */
674
675
        $this->assertEquals(
676
            $locationService->loadLocation($this->generateId('location', 5)),
677
            $location
678
        );
679
    }
680
681
    /**
682
     * Test for the loadLocationByRemoteId() method.