|
@@ 838-856 (lines=19) @@
|
| 835 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadRelations() |
| 836 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations |
| 837 |
|
*/ |
| 838 |
|
public function testLoadRelationsThrowsUnauthorizedException() |
| 839 |
|
{ |
| 840 |
|
$mediaEditor = $this->createMediaUserVersion1(); |
| 841 |
|
|
| 842 |
|
$setupRemoteId = '241d538ce310074e602f29f49e44e938'; |
| 843 |
|
|
| 844 |
|
$versionInfo = $this->contentService->loadVersionInfo( |
| 845 |
|
$this->contentService->loadContentInfoByRemoteId( |
| 846 |
|
$setupRemoteId |
| 847 |
|
) |
| 848 |
|
); |
| 849 |
|
|
| 850 |
|
$this->permissionResolver->setCurrentUserReference($mediaEditor); |
| 851 |
|
|
| 852 |
|
$this->expectException(UnauthorizedException::class); |
| 853 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 854 |
|
|
| 855 |
|
$this->contentService->loadRelations($versionInfo); |
| 856 |
|
} |
| 857 |
|
|
| 858 |
|
/** |
| 859 |
|
* Test for the loadRelations() method. |
|
@@ 904-923 (lines=20) @@
|
| 901 |
|
* @see \eZ\Publish\API\Repository\ContentService::addRelation() |
| 902 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testAddRelation |
| 903 |
|
*/ |
| 904 |
|
public function testAddRelationThrowsUnauthorizedException() |
| 905 |
|
{ |
| 906 |
|
$mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; |
| 907 |
|
|
| 908 |
|
$draft = $this->createContentDraftVersion1(); |
| 909 |
|
|
| 910 |
|
$versionInfo = $draft->getVersionInfo(); |
| 911 |
|
|
| 912 |
|
$media = $this->contentService->loadContentInfoByRemoteId($mediaRemoteId); |
| 913 |
|
|
| 914 |
|
$this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
| 915 |
|
|
| 916 |
|
$this->expectException(UnauthorizedException::class); |
| 917 |
|
$this->expectExceptionMessageRegExp('/\'versionread\' \'content\'/'); |
| 918 |
|
|
| 919 |
|
$this->contentService->addRelation( |
| 920 |
|
$versionInfo, |
| 921 |
|
$media |
| 922 |
|
); |
| 923 |
|
} |
| 924 |
|
|
| 925 |
|
/** |
| 926 |
|
* Test for the deleteRelation() method. |