|
@@ 1267-1287 (lines=21) @@
|
| 1264 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
| 1265 |
|
* @group user |
| 1266 |
|
*/ |
| 1267 |
|
public function testCreateContentDraftAndLoadAccess() |
| 1268 |
|
{ |
| 1269 |
|
$repository = $this->getRepository(); |
| 1270 |
|
|
| 1271 |
|
/* BEGIN: Use Case */ |
| 1272 |
|
$user = $this->createUserVersion1(); |
| 1273 |
|
|
| 1274 |
|
// Set new editor as user |
| 1275 |
|
$repository->setCurrentUser($user); |
| 1276 |
|
|
| 1277 |
|
// Create draft |
| 1278 |
|
$draft = $this->createContentDraftVersion1(2, 'folder'); |
| 1279 |
|
|
| 1280 |
|
// Try to load the draft |
| 1281 |
|
$contentService = $repository->getContentService(); |
| 1282 |
|
$loadedDraft = $contentService->loadContent($draft->id); |
| 1283 |
|
|
| 1284 |
|
/* END: Use Case */ |
| 1285 |
|
|
| 1286 |
|
$this->assertEquals($draft->id, $loadedDraft->id); |
| 1287 |
|
} |
| 1288 |
|
|
| 1289 |
|
/** |
| 1290 |
|
* Test for the createContentDraft() method. |
|
@@ 1885-1904 (lines=20) @@
|
| 1882 |
|
* |
| 1883 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
| 1884 |
|
*/ |
| 1885 |
|
public function testCreateContentDraftWithThirdParameter() |
| 1886 |
|
{ |
| 1887 |
|
$repository = $this->getRepository(); |
| 1888 |
|
|
| 1889 |
|
$contentService = $repository->getContentService(); |
| 1890 |
|
|
| 1891 |
|
$content = $contentService->loadContent(4); |
| 1892 |
|
$user = $this->createUserVersion1(); |
| 1893 |
|
|
| 1894 |
|
$draftContent = $contentService->createContentDraft( |
| 1895 |
|
$content->contentInfo, |
| 1896 |
|
$content->getVersionInfo(), |
| 1897 |
|
$user |
| 1898 |
|
); |
| 1899 |
|
|
| 1900 |
|
$this->assertInstanceOf( |
| 1901 |
|
Content::class, |
| 1902 |
|
$draftContent |
| 1903 |
|
); |
| 1904 |
|
} |
| 1905 |
|
|
| 1906 |
|
/** |
| 1907 |
|
* Test for the publishVersion() method. |