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