|
@@ 826-844 (lines=19) @@
|
| 823 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadRelations() |
| 824 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations |
| 825 |
|
*/ |
| 826 |
|
public function testLoadRelationsThrowsUnauthorizedException() |
| 827 |
|
{ |
| 828 |
|
$mediaEditor = $this->createMediaUserVersion1(); |
| 829 |
|
|
| 830 |
|
$setupRemoteId = '241d538ce310074e602f29f49e44e938'; |
| 831 |
|
|
| 832 |
|
$versionInfo = $this->contentService->loadVersionInfo( |
| 833 |
|
$this->contentService->loadContentInfoByRemoteId( |
| 834 |
|
$setupRemoteId |
| 835 |
|
) |
| 836 |
|
); |
| 837 |
|
|
| 838 |
|
$this->permissionResolver->setCurrentUserReference($mediaEditor); |
| 839 |
|
|
| 840 |
|
$this->expectException(UnauthorizedException::class); |
| 841 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 842 |
|
|
| 843 |
|
$this->contentService->loadRelations($versionInfo); |
| 844 |
|
} |
| 845 |
|
|
| 846 |
|
/** |
| 847 |
|
* Test for the loadRelations() method. |
|
@@ 892-911 (lines=20) @@
|
| 889 |
|
* @see \eZ\Publish\API\Repository\ContentService::addRelation() |
| 890 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testAddRelation |
| 891 |
|
*/ |
| 892 |
|
public function testAddRelationThrowsUnauthorizedException() |
| 893 |
|
{ |
| 894 |
|
$mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; |
| 895 |
|
|
| 896 |
|
$draft = $this->createContentDraftVersion1(); |
| 897 |
|
|
| 898 |
|
$versionInfo = $draft->getVersionInfo(); |
| 899 |
|
|
| 900 |
|
$media = $this->contentService->loadContentInfoByRemoteId($mediaRemoteId); |
| 901 |
|
|
| 902 |
|
$this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
| 903 |
|
|
| 904 |
|
$this->expectException(UnauthorizedException::class); |
| 905 |
|
$this->expectExceptionMessageRegExp('/\'versionread\' \'content\'/'); |
| 906 |
|
|
| 907 |
|
$this->contentService->addRelation( |
| 908 |
|
$versionInfo, |
| 909 |
|
$media |
| 910 |
|
); |
| 911 |
|
} |
| 912 |
|
|
| 913 |
|
/** |
| 914 |
|
* Test for the deleteRelation() method. |