|
@@ 108-120 (lines=13) @@
|
| 105 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContentInfo() |
| 106 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfo |
| 107 |
|
*/ |
| 108 |
|
public function testLoadContentInfoThrowsUnauthorizedException() |
| 109 |
|
{ |
| 110 |
|
$contentId = $this->generateId('object', 10); |
| 111 |
|
$this->setRestrictedEditorUser(); |
| 112 |
|
|
| 113 |
|
$this->expectException(UnauthorizedException::class); |
| 114 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 115 |
|
|
| 116 |
|
// $contentId contains a content object ID not accessible for anonymous |
| 117 |
|
$this->contentService->loadContentInfo($contentId); |
| 118 |
|
} |
| 119 |
|
|
| 120 |
|
/** |
| 121 |
|
* Test for the sudo() method. |
| 122 |
|
* |
| 123 |
|
* @see \eZ\Publish\API\Repository\Repository::sudo() |
|
@@ 216-227 (lines=12) @@
|
| 213 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById() |
| 214 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoById |
| 215 |
|
*/ |
| 216 |
|
public function testLoadVersionInfoByIdThrowsUnauthorizedException() |
| 217 |
|
{ |
| 218 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 219 |
|
$this->setRestrictedEditorUser(); |
| 220 |
|
|
| 221 |
|
$this->expectException(UnauthorizedException::class); |
| 222 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 223 |
|
|
| 224 |
|
$this->contentService->loadVersionInfoById($anonymousUserId); |
| 225 |
|
} |
| 226 |
|
|
| 227 |
|
/** |
| 228 |
|
* Test for the loadVersionInfoById() method. |
| 229 |
|
* |
| 230 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
|
@@ 233-244 (lines=12) @@
|
| 230 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
| 231 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoByIdWithSecondParameter |
| 232 |
|
*/ |
| 233 |
|
public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondParameter() |
| 234 |
|
{ |
| 235 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 236 |
|
$this->setRestrictedEditorUser(); |
| 237 |
|
|
| 238 |
|
$this->expectException(UnauthorizedException::class); |
| 239 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 240 |
|
|
| 241 |
|
$this->contentService->loadVersionInfoById($anonymousUserId, 2); |
| 242 |
|
} |
| 243 |
|
|
| 244 |
|
/** |
| 245 |
|
* Test for the loadVersionInfoById() method. |
| 246 |
|
* |
| 247 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
|
@@ 366-377 (lines=12) @@
|
| 363 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent() |
| 364 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
| 365 |
|
*/ |
| 366 |
|
public function testLoadContentThrowsUnauthorizedException() |
| 367 |
|
{ |
| 368 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 369 |
|
$this->setRestrictedEditorUser(); |
| 370 |
|
|
| 371 |
|
$this->expectException(UnauthorizedException::class); |
| 372 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 373 |
|
|
| 374 |
|
$this->contentService->loadContent($anonymousUserId); |
| 375 |
|
} |
| 376 |
|
|
| 377 |
|
/** |
| 378 |
|
* Test for the loadContent() method. |
| 379 |
|
* |
| 380 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages) |
|
@@ 383-394 (lines=12) @@
|
| 380 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages) |
| 381 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithPrioritizedLanguages |
| 382 |
|
*/ |
| 383 |
|
public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter() |
| 384 |
|
{ |
| 385 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 386 |
|
$this->setRestrictedEditorUser(); |
| 387 |
|
|
| 388 |
|
$this->expectException(UnauthorizedException::class); |
| 389 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 390 |
|
|
| 391 |
|
$this->contentService->loadContent($anonymousUserId, ['eng-US']); |
| 392 |
|
} |
| 393 |
|
|
| 394 |
|
/** |
| 395 |
|
* Test for the loadContent() method. |
| 396 |
|
* |
| 397 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo) |
|
@@ 400-411 (lines=12) @@
|
| 397 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo) |
| 398 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithThirdParameter |
| 399 |
|
*/ |
| 400 |
|
public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() |
| 401 |
|
{ |
| 402 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 403 |
|
$this->setRestrictedEditorUser(); |
| 404 |
|
|
| 405 |
|
$this->expectException(UnauthorizedException::class); |
| 406 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 407 |
|
|
| 408 |
|
$this->contentService->loadContent($anonymousUserId, ['eng-US'], 2); |
| 409 |
|
} |
| 410 |
|
|
| 411 |
|
/** |
| 412 |
|
* Test for the loadContent() method on a draft. |
| 413 |
|
* |
| 414 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent() |