| @@ 148-158 (lines=11) @@ | ||
| 145 | * @see \eZ\Publish\API\Repository\ContentService::loadContentInfoList() |
|
| 146 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfoList |
|
| 147 | */ |
|
| 148 | public function testLoadContentInfoListSkipsUnauthorizedItems() |
|
| 149 | { |
|
| 150 | $repository = $this->getRepository(); |
|
| 151 | $contentId = $this->generateId('object', 10); |
|
| 152 | $contentService = $repository->getContentService(); |
|
| 153 | $repository->setCurrentUser($this->createAnonymousWithEditorRole()); |
|
| 154 | ||
| 155 | $list = $contentService->loadContentInfoList([$contentId]); |
|
| 156 | ||
| 157 | $this->assertCount(0, $list); |
|
| 158 | } |
|
| 159 | ||
| 160 | /** |
|
| 161 | * Test for the loadContentInfoByRemoteId() method. |
|
| @@ 562-581 (lines=20) @@ | ||
| 559 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 560 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithThirdParameter |
|
| 561 | */ |
|
| 562 | public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() |
|
| 563 | { |
|
| 564 | $repository = $this->getRepository(); |
|
| 565 | ||
| 566 | $anonymousUserId = $this->generateId('user', 10); |
|
| 567 | /* BEGIN: Use Case */ |
|
| 568 | // $anonymousUserId is the ID of the "Anonymous User" in an eZ Publish |
|
| 569 | // demo installation |
|
| 570 | ||
| 571 | $contentService = $repository->getContentService(); |
|
| 572 | ||
| 573 | $pseudoEditor = $this->createAnonymousWithEditorRole(); |
|
| 574 | ||
| 575 | // Set restricted editor user |
|
| 576 | $repository->setCurrentUser($pseudoEditor); |
|
| 577 | ||
| 578 | // This call will fail with a "UnauthorizedException" |
|
| 579 | $contentService->loadContent($anonymousUserId, array('eng-US'), 2); |
|
| 580 | /* END: Use Case */ |
|
| 581 | } |
|
| 582 | ||
| 583 | /** |
|
| 584 | * Test for the loadContent() method on a draft. |
|
| @@ 718-738 (lines=21) @@ | ||
| 715 | * |
|
| 716 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById() |
|
| 717 | */ |
|
| 718 | public function testLoadVersionInfoById() |
|
| 719 | { |
|
| 720 | $repository = $this->getRepository(); |
|
| 721 | ||
| 722 | $mediaFolderId = $this->generateId('object', 41); |
|
| 723 | /* BEGIN: Use Case */ |
|
| 724 | // $mediaFolderId contains the ID of the "Media" folder |
|
| 725 | ||
| 726 | $contentService = $repository->getContentService(); |
|
| 727 | ||
| 728 | // Load the VersionInfo for "Media" folder |
|
| 729 | $versionInfo = $contentService->loadVersionInfoById($mediaFolderId); |
|
| 730 | /* END: Use Case */ |
|
| 731 | ||
| 732 | $this->assertInstanceOf( |
|
| 733 | '\\eZ\\Publish\\API\\Repository\\Values\\Content\\VersionInfo', |
|
| 734 | $versionInfo |
|
| 735 | ); |
|
| 736 | ||
| 737 | return $versionInfo; |
|
| 738 | } |
|
| 739 | ||
| 740 | /** |
|
| 741 | * Test for the returned value of the loadVersionInfoById() method. |
|