Code Duplication    Length = 17-19 lines in 3 locations

eZ/Publish/API/Repository/Tests/LocationServiceAuthorizationTest.php 2 locations

@@ 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 loadLocationByRemoteId() method.
@@ 156-174 (lines=19) @@
153
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
154
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationByRemoteId
155
     */
156
    public function testLoadLocationByRemoteIdThrowsUnauthorizedException()
157
    {
158
        $repository = $this->getRepository();
159
160
        /* BEGIN: Use Case */
161
        // remoteId of the "Editors" location in an eZ Publish demo installation
162
        $editorsRemoteId = 'f7dda2854fc68f7c8455d9cb14bd04a9';
163
164
        $locationService = $repository->getLocationService();
165
166
        $user = $this->createUserVersion1();
167
168
        // Set current user to newly created user
169
        $repository->setCurrentUser($user);
170
171
        // This call will fail with an "UnauthorizedException"
172
        $locationService->loadLocationByRemoteId($editorsRemoteId);
173
        /* END: Use Case */
174
    }
175
176
    /**
177
     * Test for the loadLocations() method.

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

@@ 559-575 (lines=17) @@
556
     * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId()
557
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation
558
     */
559
    public function testLoadLocationByRemoteId()
560
    {
561
        $repository = $this->getRepository();
562
563
        /* BEGIN: Use Case */
564
        $locationService = $repository->getLocationService();
565
566
        $location = $locationService->loadLocationByRemoteId(
567
            '3f6d92f8044aed134f32153517850f5a'
568
        );
569
        /* END: Use Case */
570
571
        $this->assertEquals(
572
            $locationService->loadLocation($this->generateId('location', 5)),
573
            $location
574
        );
575
    }
576
577
    /**
578
     * Test for the loadLocationByRemoteId() method.