Code Duplication    Length = 20-20 lines in 2 locations

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

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