Code Duplication    Length = 13-15 lines in 4 locations

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

@@ 316-328 (lines=13) @@
313
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages)
314
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithLanguageParameters
315
     */
316
    public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecondParameter()
317
    {
318
        /* BEGIN: Use Case */
319
        $contentInfo = $this->getContentInfoForAnonymousUser();
320
321
        $this->setRestrictedEditorUser();
322
323
        $this->expectException(UnauthorizedException::class);
324
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
325
326
        $this->contentService->loadContentByContentInfo($contentInfo, ['eng-US']);
327
        /* END: Use Case */
328
    }
329
330
    /**
331
     * Test for the loadContentByContentInfo() method.
@@ 336-348 (lines=13) @@
333
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
334
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithVersionNumberParameter
335
     */
336
    public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThirdParameter()
337
    {
338
        /* BEGIN: Use Case */
339
        $contentInfo = $this->getContentInfoForAnonymousUser();
340
341
        $this->setRestrictedEditorUser();
342
343
        $this->expectException(UnauthorizedException::class);
344
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
345
346
        $this->contentService->loadContentByContentInfo($contentInfo, ['eng-US'], 2);
347
        /* END: Use Case */
348
    }
349
350
    /**
351
     * Test for the loadContentByVersionInfo() method.
@@ 356-370 (lines=15) @@
353
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo()
354
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfo
355
     */
356
    public function testLoadContentByVersionInfoThrowsUnauthorizedException()
357
    {
358
        /* BEGIN: Use Case */
359
        $contentInfo = $this->getContentInfoForAnonymousUser();
360
361
        $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
362
363
        $this->setRestrictedEditorUser();
364
365
        $this->expectException(UnauthorizedException::class);
366
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
367
368
        $this->contentService->loadContentByVersionInfo($versionInfo);
369
        /* END: Use Case */
370
    }
371
372
    /**
373
     * Test for the loadContentByVersionInfo() method.
@@ 378-392 (lines=15) @@
375
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo($versionInfo, $languages)
376
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfoWithSecondParameter
377
     */
378
    public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecondParameter()
379
    {
380
        /* BEGIN: Use Case */
381
        $contentInfo = $this->getContentInfoForAnonymousUser();
382
383
        $versionInfo = $this->contentService->loadVersionInfo($contentInfo);
384
385
        $this->setRestrictedEditorUser();
386
387
        $this->expectException(UnauthorizedException::class);
388
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
389
390
        $this->contentService->loadContentByVersionInfo($versionInfo, ['eng-US']);
391
        /* END: Use Case */
392
    }
393
394
    /**
395
     * Test for the loadContent() method.