Code Duplication    Length = 11-11 lines in 4 locations

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

@@ 162-172 (lines=11) @@
159
     * @see \eZ\Publish\API\Repository\ContentService::loadContentInfoByRemoteId()
160
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfoByRemoteId
161
     */
162
    public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException()
163
    {
164
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
165
166
        $this->setRestrictedEditorUser();
167
168
        $this->expectException(UnauthorizedException::class);
169
        $this->expectExceptionMessageMatches('/\'read\' \'content\'/');
170
171
        $this->contentService->loadContentInfoByRemoteId($anonymousRemoteId);
172
    }
173
174
    /**
175
     * Test for the loadVersionInfo() method.
@@ 488-498 (lines=11) @@
485
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId()
486
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId
487
     */
488
    public function testLoadContentByRemoteIdThrowsUnauthorizedException()
489
    {
490
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
491
492
        $this->setRestrictedEditorUser();
493
494
        $this->expectException(UnauthorizedException::class);
495
        $this->expectExceptionMessageMatches('/\'read\' \'content\'/');
496
497
        $this->contentService->loadContentByRemoteId($anonymousRemoteId);
498
    }
499
500
    /**
501
     * Test for the loadContentByRemoteId() method.
@@ 506-516 (lines=11) @@
503
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages)
504
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithSecondParameter
505
     */
506
    public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondParameter()
507
    {
508
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
509
510
        $this->setRestrictedEditorUser();
511
512
        $this->expectException(UnauthorizedException::class);
513
        $this->expectExceptionMessageMatches('/\'read\' \'content\'/');
514
515
        $this->contentService->loadContentByRemoteId($anonymousRemoteId, ['eng-US']);
516
    }
517
518
    /**
519
     * Test for the loadContentByRemoteId() method.
@@ 524-534 (lines=11) @@
521
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
522
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithThirdParameter
523
     */
524
    public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdParameter()
525
    {
526
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
527
528
        $this->setRestrictedEditorUser();
529
530
        $this->expectException(UnauthorizedException::class);
531
        $this->expectExceptionMessageMatches('/\'read\' \'content\'/');
532
533
        $this->contentService->loadContentByRemoteId($anonymousRemoteId, ['eng-US'], 2);
534
    }
535
536
    /**
537
     * Test for the updateContentMetadata() method.