| @@ 1772-1784 (lines=13) @@ | ||
| 1769 | * @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
|
| 1770 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 1771 | */ |
|
| 1772 | public function testCreateContentDraftThrowsBadStateException() |
|
| 1773 | { |
|
| 1774 | $contentService = $this->repository->getContentService(); |
|
| 1775 | $contentInfo = $contentService->loadContentInfo(4); |
|
| 1776 | $draftContent = $contentService->createContentDraft($contentInfo); |
|
| 1777 | ||
| 1778 | // Throws an exception because version status is not |
|
| 1779 | // VersionInfo::STATUS_PUBLISHED nor VersionInfo::STATUS_ARCHIVED |
|
| 1780 | $draftContent = $contentService->createContentDraft( |
|
| 1781 | $draftContent->contentInfo, |
|
| 1782 | $draftContent->getVersionInfo() |
|
| 1783 | ); |
|
| 1784 | } |
|
| 1785 | ||
| 1786 | /** |
|
| 1787 | * Test for the createContentDraft() method. |
|
| @@ 1586-1603 (lines=18) @@ | ||
| 1583 | * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
|
| 1584 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
|
| 1585 | */ |
|
| 1586 | public function testCreateContentDraftWithSecondParameter() |
|
| 1587 | { |
|
| 1588 | $repository = $this->getRepository(); |
|
| 1589 | ||
| 1590 | $contentService = $repository->getContentService(); |
|
| 1591 | ||
| 1592 | /* BEGIN: Use Case */ |
|
| 1593 | $contentVersion2 = $this->createContentVersion2(); |
|
| 1594 | ||
| 1595 | // Now we create a new draft from the initial version |
|
| 1596 | $draftedContentReloaded = $contentService->createContentDraft( |
|
| 1597 | $contentVersion2->contentInfo, |
|
| 1598 | $contentVersion2->getVersionInfo() |
|
| 1599 | ); |
|
| 1600 | /* END: Use Case */ |
|
| 1601 | ||
| 1602 | $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo); |
|
| 1603 | } |
|
| 1604 | ||
| 1605 | /** |
|
| 1606 | * Test for the publishVersion() method. |
|