|
@@ 1171-1195 (lines=25) @@
|
| 1168 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 1169 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations |
| 1170 |
|
*/ |
| 1171 |
|
public function testLoadRelationsThrowsUnauthorizedException() |
| 1172 |
|
{ |
| 1173 |
|
$repository = $this->getRepository(); |
| 1174 |
|
|
| 1175 |
|
$contentService = $repository->getContentService(); |
| 1176 |
|
|
| 1177 |
|
/* BEGIN: Use Case */ |
| 1178 |
|
$user = $this->createMediaUserVersion1(); |
| 1179 |
|
|
| 1180 |
|
// Remote id of the "Setup" page of a eZ Publish demo installation. |
| 1181 |
|
$setupRemoteId = '241d538ce310074e602f29f49e44e938'; |
| 1182 |
|
|
| 1183 |
|
$versionInfo = $contentService->loadVersionInfo( |
| 1184 |
|
$contentService->loadContentInfoByRemoteId( |
| 1185 |
|
$setupRemoteId |
| 1186 |
|
) |
| 1187 |
|
); |
| 1188 |
|
|
| 1189 |
|
// Set media editor as current user |
| 1190 |
|
$repository->setCurrentUser($user); |
| 1191 |
|
|
| 1192 |
|
// This call will fail with a "UnauthorizedException" |
| 1193 |
|
$contentService->loadRelations($versionInfo); |
| 1194 |
|
/* END: Use Case */ |
| 1195 |
|
} |
| 1196 |
|
|
| 1197 |
|
/** |
| 1198 |
|
* Test for the loadRelations() method. |
|
@@ 1234-1256 (lines=23) @@
|
| 1231 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 1232 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadReverseRelations |
| 1233 |
|
*/ |
| 1234 |
|
public function testLoadReverseRelationsThrowsUnauthorizedException() |
| 1235 |
|
{ |
| 1236 |
|
$repository = $this->getRepository(); |
| 1237 |
|
|
| 1238 |
|
$contentService = $repository->getContentService(); |
| 1239 |
|
|
| 1240 |
|
/* BEGIN: Use Case */ |
| 1241 |
|
$user = $this->createMediaUserVersion1(); |
| 1242 |
|
|
| 1243 |
|
// Remote id of the "Media" page of a eZ Publish demo installation. |
| 1244 |
|
$mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; |
| 1245 |
|
|
| 1246 |
|
$contentInfo = $contentService->loadContentInfoByRemoteId( |
| 1247 |
|
$mediaRemoteId |
| 1248 |
|
); |
| 1249 |
|
|
| 1250 |
|
// Set media editor as current user |
| 1251 |
|
$repository->setCurrentUser($user); |
| 1252 |
|
|
| 1253 |
|
// This call will fail with a "UnauthorizedException" |
| 1254 |
|
$contentService->loadReverseRelations($contentInfo); |
| 1255 |
|
/* END: Use Case */ |
| 1256 |
|
} |
| 1257 |
|
|
| 1258 |
|
/** |
| 1259 |
|
* Test for the addRelation() method. |