Code Duplication    Length = 23-25 lines in 2 locations

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

@@ 1154-1178 (lines=25) @@
1151
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
1152
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations
1153
     */
1154
    public function testLoadRelationsThrowsUnauthorizedException()
1155
    {
1156
        $repository = $this->getRepository();
1157
1158
        $contentService = $repository->getContentService();
1159
1160
        /* BEGIN: Use Case */
1161
        $user = $this->createMediaUserVersion1();
1162
1163
        // Remote id of the "Setup" page of a eZ Publish demo installation.
1164
        $setupRemoteId = '241d538ce310074e602f29f49e44e938';
1165
1166
        $versionInfo = $contentService->loadVersionInfo(
1167
            $contentService->loadContentInfoByRemoteId(
1168
                $setupRemoteId
1169
            )
1170
        );
1171
1172
        // Set media editor as current user
1173
        $repository->setCurrentUser($user);
1174
1175
        // This call will fail with a "UnauthorizedException"
1176
        $contentService->loadRelations($versionInfo);
1177
        /* END: Use Case */
1178
    }
1179
1180
    /**
1181
     * Test for the loadRelations() method.
@@ 1217-1239 (lines=23) @@
1214
     * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
1215
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadReverseRelations
1216
     */
1217
    public function testLoadReverseRelationsThrowsUnauthorizedException()
1218
    {
1219
        $repository = $this->getRepository();
1220
1221
        $contentService = $repository->getContentService();
1222
1223
        /* BEGIN: Use Case */
1224
        $user = $this->createMediaUserVersion1();
1225
1226
        // Remote id of the "Media" page of a eZ Publish demo installation.
1227
        $mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262';
1228
1229
        $contentInfo = $contentService->loadContentInfoByRemoteId(
1230
            $mediaRemoteId
1231
        );
1232
1233
        // Set media editor as current user
1234
        $repository->setCurrentUser($user);
1235
1236
        // This call will fail with a "UnauthorizedException"
1237
        $contentService->loadReverseRelations($contentInfo);
1238
        /* END: Use Case */
1239
    }
1240
1241
    /**
1242
     * Test for the addRelation() method.