|
@@ 1171-1191 (lines=21) @@
|
| 1168 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
| 1169 |
|
* @group user |
| 1170 |
|
*/ |
| 1171 |
|
public function testCreateContentDraftAndLoadAccess() |
| 1172 |
|
{ |
| 1173 |
|
$repository = $this->getRepository(); |
| 1174 |
|
|
| 1175 |
|
/* BEGIN: Use Case */ |
| 1176 |
|
$user = $this->createUserVersion1(); |
| 1177 |
|
|
| 1178 |
|
// Set new editor as user |
| 1179 |
|
$repository->setCurrentUser($user); |
| 1180 |
|
|
| 1181 |
|
// Create draft |
| 1182 |
|
$draft = $this->createContentDraftVersion1(2, 'folder'); |
| 1183 |
|
|
| 1184 |
|
// Try to load the draft |
| 1185 |
|
$contentService = $repository->getContentService(); |
| 1186 |
|
$loadedDraft = $contentService->loadContent($draft->id); |
| 1187 |
|
|
| 1188 |
|
/* END: Use Case */ |
| 1189 |
|
|
| 1190 |
|
$this->assertEquals($draft->id, $loadedDraft->id); |
| 1191 |
|
} |
| 1192 |
|
|
| 1193 |
|
/** |
| 1194 |
|
* Test for the createContentDraft() method. |
|
@@ 1789-1808 (lines=20) @@
|
| 1786 |
|
* |
| 1787 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
| 1788 |
|
*/ |
| 1789 |
|
public function testCreateContentDraftWithThirdParameter() |
| 1790 |
|
{ |
| 1791 |
|
$repository = $this->getRepository(); |
| 1792 |
|
|
| 1793 |
|
$contentService = $repository->getContentService(); |
| 1794 |
|
|
| 1795 |
|
$content = $contentService->loadContent(4); |
| 1796 |
|
$user = $this->createUserVersion1(); |
| 1797 |
|
|
| 1798 |
|
$draftContent = $contentService->createContentDraft( |
| 1799 |
|
$content->contentInfo, |
| 1800 |
|
$content->getVersionInfo(), |
| 1801 |
|
$user |
| 1802 |
|
); |
| 1803 |
|
|
| 1804 |
|
$this->assertInstanceOf( |
| 1805 |
|
Content::class, |
| 1806 |
|
$draftContent |
| 1807 |
|
); |
| 1808 |
|
} |
| 1809 |
|
|
| 1810 |
|
/** |
| 1811 |
|
* Test for the publishVersion() method. |