Code Duplication    Length = 20-20 lines in 2 locations

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

@@ 229-248 (lines=20) @@
226
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
227
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testHideLocation
228
     */
229
    public function testHideLocationThrowsUnauthorizedException()
230
    {
231
        $repository = $this->getRepository();
232
233
        $editorsGroupId = $this->generateId('group', 13);
234
235
        /* BEGIN: Use Case */
236
        $user = $this->createUserVersion1();
237
238
        $locationService = $repository->getLocationService();
239
240
        $visibleLocation = $locationService->loadLocation($editorsGroupId);
241
242
        // Set current user to newly created user
243
        $repository->setCurrentUser($user);
244
245
        // This call will fail with an "UnauthorizedException"
246
        $locationService->hideLocation($visibleLocation);
247
        /* END: Use Case */
248
    }
249
250
    /**
251
     * Test for the unhideLocation() method.
@@ 288-307 (lines=20) @@
285
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
286
     * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testDeleteLocation
287
     */
288
    public function testDeleteLocationThrowsUnauthorizedException()
289
    {
290
        $repository = $this->getRepository();
291
292
        $editorsGroupId = $this->generateId('group', 13);
293
294
        /* BEGIN: Use Case */
295
        $user = $this->createUserVersion1();
296
297
        $locationService = $repository->getLocationService();
298
299
        $location = $locationService->loadLocation($editorsGroupId);
300
301
        // Set current user to newly created user
302
        $repository->setCurrentUser($user);
303
304
        // This call will fail with an "UnauthorizedException"
305
        $locationService->deleteLocation($location);
306
        /* END: Use Case */
307
    }
308
309
    /**
310
     * Test for the deleteLocation() method.