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