|
@@ 118-130 (lines=13) @@
|
| 115 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContentInfo() |
| 116 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfo |
| 117 |
|
*/ |
| 118 |
|
public function testLoadContentInfoThrowsUnauthorizedException() |
| 119 |
|
{ |
| 120 |
|
$contentId = $this->generateId('object', 10); |
| 121 |
|
/* BEGIN: Use Case */ |
| 122 |
|
$this->setRestrictedEditorUser(); |
| 123 |
|
|
| 124 |
|
$this->expectException(UnauthorizedException::class); |
| 125 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 126 |
|
|
| 127 |
|
// $contentId contains a content object ID not accessible for anonymous |
| 128 |
|
$this->contentService->loadContentInfo($contentId); |
| 129 |
|
/* END: Use Case */ |
| 130 |
|
} |
| 131 |
|
|
| 132 |
|
/** |
| 133 |
|
* Test for the sudo() method. |
|
@@ 234-245 (lines=12) @@
|
| 231 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById() |
| 232 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoById |
| 233 |
|
*/ |
| 234 |
|
public function testLoadVersionInfoByIdThrowsUnauthorizedException() |
| 235 |
|
{ |
| 236 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 237 |
|
/* BEGIN: Use Case */ |
| 238 |
|
$this->setRestrictedEditorUser(); |
| 239 |
|
|
| 240 |
|
$this->expectException(UnauthorizedException::class); |
| 241 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 242 |
|
|
| 243 |
|
$this->contentService->loadVersionInfoById($anonymousUserId); |
| 244 |
|
/* END: Use Case */ |
| 245 |
|
} |
| 246 |
|
|
| 247 |
|
/** |
| 248 |
|
* Test for the loadVersionInfoById() method. |
|
@@ 253-264 (lines=12) @@
|
| 250 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
| 251 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoByIdWithSecondParameter |
| 252 |
|
*/ |
| 253 |
|
public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondParameter() |
| 254 |
|
{ |
| 255 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 256 |
|
/* BEGIN: Use Case */ |
| 257 |
|
$this->setRestrictedEditorUser(); |
| 258 |
|
|
| 259 |
|
$this->expectException(UnauthorizedException::class); |
| 260 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 261 |
|
|
| 262 |
|
$this->contentService->loadVersionInfoById($anonymousUserId, 2); |
| 263 |
|
/* END: Use Case */ |
| 264 |
|
} |
| 265 |
|
|
| 266 |
|
/** |
| 267 |
|
* Test for the loadVersionInfoById() method. |
|
@@ 400-411 (lines=12) @@
|
| 397 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent() |
| 398 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
| 399 |
|
*/ |
| 400 |
|
public function testLoadContentThrowsUnauthorizedException() |
| 401 |
|
{ |
| 402 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 403 |
|
/* BEGIN: Use Case */ |
| 404 |
|
$this->setRestrictedEditorUser(); |
| 405 |
|
|
| 406 |
|
$this->expectException(UnauthorizedException::class); |
| 407 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 408 |
|
|
| 409 |
|
$this->contentService->loadContent($anonymousUserId); |
| 410 |
|
/* END: Use Case */ |
| 411 |
|
} |
| 412 |
|
|
| 413 |
|
/** |
| 414 |
|
* Test for the loadContent() method. |
|
@@ 419-430 (lines=12) @@
|
| 416 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages) |
| 417 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithSecondParameter |
| 418 |
|
*/ |
| 419 |
|
public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter() |
| 420 |
|
{ |
| 421 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 422 |
|
/* BEGIN: Use Case */ |
| 423 |
|
$this->setRestrictedEditorUser(); |
| 424 |
|
|
| 425 |
|
$this->expectException(UnauthorizedException::class); |
| 426 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 427 |
|
|
| 428 |
|
$this->contentService->loadContent($anonymousUserId, ['eng-US']); |
| 429 |
|
/* END: Use Case */ |
| 430 |
|
} |
| 431 |
|
|
| 432 |
|
/** |
| 433 |
|
* Test for the loadContent() method. |
|
@@ 438-449 (lines=12) @@
|
| 435 |
|
* @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo) |
| 436 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithThirdParameter |
| 437 |
|
*/ |
| 438 |
|
public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() |
| 439 |
|
{ |
| 440 |
|
$anonymousUserId = $this->generateId('user', 10); |
| 441 |
|
/* BEGIN: Use Case */ |
| 442 |
|
$this->setRestrictedEditorUser(); |
| 443 |
|
|
| 444 |
|
$this->expectException(UnauthorizedException::class); |
| 445 |
|
$this->expectExceptionMessageRegExp('/\'read\' \'content\'/'); |
| 446 |
|
|
| 447 |
|
$this->contentService->loadContent($anonymousUserId, ['eng-US'], 2); |
| 448 |
|
/* END: Use Case */ |
| 449 |
|
} |
| 450 |
|
|
| 451 |
|
/** |
| 452 |
|
* Test for the loadContent() method on a draft. |