|
@@ 1229-1249 (lines=21) @@
|
| 1226 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
| 1227 |
|
* @group user |
| 1228 |
|
*/ |
| 1229 |
|
public function testCreateContentDraftAndLoadAccess() |
| 1230 |
|
{ |
| 1231 |
|
$repository = $this->getRepository(); |
| 1232 |
|
|
| 1233 |
|
/* BEGIN: Use Case */ |
| 1234 |
|
$user = $this->createUserVersion1(); |
| 1235 |
|
|
| 1236 |
|
// Set new editor as user |
| 1237 |
|
$repository->setCurrentUser($user); |
| 1238 |
|
|
| 1239 |
|
// Create draft |
| 1240 |
|
$draft = $this->createContentDraftVersion1(2, 'folder'); |
| 1241 |
|
|
| 1242 |
|
// Try to load the draft |
| 1243 |
|
$contentService = $repository->getContentService(); |
| 1244 |
|
$loadedDraft = $contentService->loadContent($draft->id); |
| 1245 |
|
|
| 1246 |
|
/* END: Use Case */ |
| 1247 |
|
|
| 1248 |
|
$this->assertEquals($draft->id, $loadedDraft->id); |
| 1249 |
|
} |
| 1250 |
|
|
| 1251 |
|
/** |
| 1252 |
|
* Test for the createContentDraft() method. |
|
@@ 1847-1866 (lines=20) @@
|
| 1844 |
|
* |
| 1845 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
| 1846 |
|
*/ |
| 1847 |
|
public function testCreateContentDraftWithThirdParameter() |
| 1848 |
|
{ |
| 1849 |
|
$repository = $this->getRepository(); |
| 1850 |
|
|
| 1851 |
|
$contentService = $repository->getContentService(); |
| 1852 |
|
|
| 1853 |
|
$content = $contentService->loadContent(4); |
| 1854 |
|
$user = $this->createUserVersion1(); |
| 1855 |
|
|
| 1856 |
|
$draftContent = $contentService->createContentDraft( |
| 1857 |
|
$content->contentInfo, |
| 1858 |
|
$content->getVersionInfo(), |
| 1859 |
|
$user |
| 1860 |
|
); |
| 1861 |
|
|
| 1862 |
|
$this->assertInstanceOf( |
| 1863 |
|
Content::class, |
| 1864 |
|
$draftContent |
| 1865 |
|
); |
| 1866 |
|
} |
| 1867 |
|
|
| 1868 |
|
/** |
| 1869 |
|
* Test for the publishVersion() method. |