|
@@ 1280-1300 (lines=21) @@
|
| 1277 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
| 1278 |
|
* @group user |
| 1279 |
|
*/ |
| 1280 |
|
public function testCreateContentDraftAndLoadAccess() |
| 1281 |
|
{ |
| 1282 |
|
$repository = $this->getRepository(); |
| 1283 |
|
|
| 1284 |
|
/* BEGIN: Use Case */ |
| 1285 |
|
$user = $this->createUserVersion1(); |
| 1286 |
|
|
| 1287 |
|
// Set new editor as user |
| 1288 |
|
$repository->setCurrentUser($user); |
| 1289 |
|
|
| 1290 |
|
// Create draft |
| 1291 |
|
$draft = $this->createContentDraftVersion1(2, 'folder'); |
| 1292 |
|
|
| 1293 |
|
// Try to load the draft |
| 1294 |
|
$contentService = $repository->getContentService(); |
| 1295 |
|
$loadedDraft = $contentService->loadContent($draft->id); |
| 1296 |
|
|
| 1297 |
|
/* END: Use Case */ |
| 1298 |
|
|
| 1299 |
|
$this->assertEquals($draft->id, $loadedDraft->id); |
| 1300 |
|
} |
| 1301 |
|
|
| 1302 |
|
/** |
| 1303 |
|
* Test for the createContentDraft() method. |
|
@@ 1902-1921 (lines=20) @@
|
| 1899 |
|
* |
| 1900 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
| 1901 |
|
*/ |
| 1902 |
|
public function testCreateContentDraftWithThirdParameter() |
| 1903 |
|
{ |
| 1904 |
|
$repository = $this->getRepository(); |
| 1905 |
|
|
| 1906 |
|
$contentService = $repository->getContentService(); |
| 1907 |
|
|
| 1908 |
|
$content = $contentService->loadContent(4); |
| 1909 |
|
$user = $this->createUserVersion1(); |
| 1910 |
|
|
| 1911 |
|
$draftContent = $contentService->createContentDraft( |
| 1912 |
|
$content->contentInfo, |
| 1913 |
|
$content->getVersionInfo(), |
| 1914 |
|
$user |
| 1915 |
|
); |
| 1916 |
|
|
| 1917 |
|
$this->assertInstanceOf( |
| 1918 |
|
Content::class, |
| 1919 |
|
$draftContent |
| 1920 |
|
); |
| 1921 |
|
} |
| 1922 |
|
|
| 1923 |
|
/** |
| 1924 |
|
* Test for the publishVersion() method. |