Code Duplication    Length = 13-15 lines in 4 locations

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

@@ 296-308 (lines=13) @@
293
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages)
294
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithLanguageParameters
295
     */
296
    public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecondParameter()
297
    {
298
        $contentInfo = $this->getContentInfoForAnonymousUser();
299
300
        $this->setRestrictedEditorUser();
301
302
        $this->expectException(UnauthorizedException::class);
303
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
304
305
        $this->contentService->loadContentByContentInfo($contentInfo, ['eng-US']);
306
    }
307
308
    /**
309
     * Test for the loadContentByContentInfo() method.
310
     *
311
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
@@ 314-326 (lines=13) @@
311
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
312
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithVersionNumberParameter
313
     */
314
    public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThirdParameter()
315
    {
316
        $contentInfo = $this->getContentInfoForAnonymousUser();
317
318
        $this->setRestrictedEditorUser();
319
320
        $this->expectException(UnauthorizedException::class);
321
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
322
323
        $this->contentService->loadContentByContentInfo($contentInfo, ['eng-US'], 2);
324
    }
325
326
    /**
327
     * Test for the loadContentByVersionInfo() method.
328
     *
329
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo()
@@ 332-346 (lines=15) @@
329
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo()
330
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfo
331
     */
332
    public function testLoadContentByVersionInfoThrowsUnauthorizedException()
333
    {
334
        $contentInfo = $this->getContentInfoForAnonymousUser();
335
336
        $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
337
338
        $this->setRestrictedEditorUser();
339
340
        $this->expectException(UnauthorizedException::class);
341
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
342
343
        $this->contentService->loadContentByVersionInfo($versionInfo);
344
    }
345
346
    /**
347
     * Test for the loadContentByVersionInfo() method.
348
     *
349
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo($versionInfo, $languages)
@@ 352-366 (lines=15) @@
349
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo($versionInfo, $languages)
350
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfoWithSecondParameter
351
     */
352
    public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecondParameter()
353
    {
354
        $contentInfo = $this->getContentInfoForAnonymousUser();
355
356
        $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
357
358
        $this->setRestrictedEditorUser();
359
360
        $this->expectException(UnauthorizedException::class);
361
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
362
363
        $this->contentService->loadContentByVersionInfo($versionInfo, ['eng-US']);
364
    }
365
366
    /**
367
     * Test for the loadContent() method.
368
     *
369
     * @see \eZ\Publish\API\Repository\ContentService::loadContent()