Code Duplication    Length = 13-13 lines in 4 locations

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

@@ 168-180 (lines=13) @@
165
     * @see \eZ\Publish\API\Repository\ContentService::loadContentInfoByRemoteId()
166
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfoByRemoteId
167
     */
168
    public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException()
169
    {
170
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
171
172
        $this->setRestrictedEditorUser();
173
174
        $this->expectException(UnauthorizedException::class);
175
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
176
177
        $this->contentService->loadContentInfoByRemoteId($anonymousRemoteId);
178
    }
179
180
    /**
181
     * Test for the loadVersionInfo() method.
182
     *
183
     * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfo()
@@ 494-506 (lines=13) @@
491
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId()
492
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId
493
     */
494
    public function testLoadContentByRemoteIdThrowsUnauthorizedException()
495
    {
496
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
497
498
        $this->setRestrictedEditorUser();
499
500
        $this->expectException(UnauthorizedException::class);
501
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
502
503
        $this->contentService->loadContentByRemoteId($anonymousRemoteId);
504
    }
505
506
    /**
507
     * Test for the loadContentByRemoteId() method.
508
     *
509
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages)
@@ 512-524 (lines=13) @@
509
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages)
510
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithSecondParameter
511
     */
512
    public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondParameter()
513
    {
514
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
515
516
        $this->setRestrictedEditorUser();
517
518
        $this->expectException(UnauthorizedException::class);
519
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
520
521
        $this->contentService->loadContentByRemoteId($anonymousRemoteId, ['eng-US']);
522
    }
523
524
    /**
525
     * Test for the loadContentByRemoteId() method.
526
     *
527
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
@@ 530-542 (lines=13) @@
527
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
528
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithThirdParameter
529
     */
530
    public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdParameter()
531
    {
532
        $anonymousRemoteId = 'faaeb9be3bd98ed09f606fc16d144eca';
533
534
        $this->setRestrictedEditorUser();
535
536
        $this->expectException(UnauthorizedException::class);
537
        $this->expectExceptionMessageRegExp('/\'read\' \'content\'/');
538
539
        $this->contentService->loadContentByRemoteId($anonymousRemoteId, ['eng-US'], 2);
540
    }
541
542
    /**
543
     * Test for the updateContentMetadata() method.
544
     *
545
     * @see \eZ\Publish\API\Repository\ContentService::updateContentMetadata()