Code Duplication    Length = 23-25 lines in 2 locations

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

@@ 1196-1220 (lines=25) @@
1193
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
1194
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations
1195
     */
1196
    public function testLoadRelationsThrowsUnauthorizedException()
1197
    {
1198
        $repository = $this->getRepository();
1199
1200
        $contentService = $repository->getContentService();
1201
1202
        /* BEGIN: Use Case */
1203
        $user = $this->createMediaUserVersion1();
1204
1205
        // Remote id of the "Setup" page of a eZ Publish demo installation.
1206
        $setupRemoteId = '241d538ce310074e602f29f49e44e938';
1207
1208
        $versionInfo = $contentService->loadVersionInfo(
1209
            $contentService->loadContentInfoByRemoteId(
1210
                $setupRemoteId
1211
            )
1212
        );
1213
1214
        // Set media editor as current user
1215
        $repository->setCurrentUser($user);
1216
1217
        // This call will fail with a "UnauthorizedException"
1218
        $contentService->loadRelations($versionInfo);
1219
        /* END: Use Case */
1220
    }
1221
1222
    /**
1223
     * Test for the loadRelations() method.
@@ 1259-1281 (lines=23) @@
1256
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
1257
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadReverseRelations
1258
     */
1259
    public function testLoadReverseRelationsThrowsUnauthorizedException()
1260
    {
1261
        $repository = $this->getRepository();
1262
1263
        $contentService = $repository->getContentService();
1264
1265
        /* BEGIN: Use Case */
1266
        $user = $this->createMediaUserVersion1();
1267
1268
        // Remote id of the "Media" page of a eZ Publish demo installation.
1269
        $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
1270
1271
        $contentInfo = $contentService->loadContentInfoByRemoteId(
1272
            $mediaRemoteId
1273
        );
1274
1275
        // Set media editor as current user
1276
        $repository->setCurrentUser($user);
1277
1278
        // This call will fail with a "UnauthorizedException"
1279
        $contentService->loadReverseRelations($contentInfo);
1280
        /* END: Use Case */
1281
    }
1282
1283
    /**
1284
     * Test for the addRelation() method.