| @@ 1532-1549 (lines=18) @@ | ||
| 1529 | * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
|
| 1530 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
|
| 1531 | */ |
|
| 1532 | public function testCreateContentDraftWithSecondParameter() |
|
| 1533 | { |
|
| 1534 | $repository = $this->getRepository(); |
|
| 1535 | ||
| 1536 | $contentService = $repository->getContentService(); |
|
| 1537 | ||
| 1538 | /* BEGIN: Use Case */ |
|
| 1539 | $contentVersion2 = $this->createContentVersion2(); |
|
| 1540 | ||
| 1541 | // Now we create a new draft from the initial version |
|
| 1542 | $draftedContentReloaded = $contentService->createContentDraft( |
|
| 1543 | $contentVersion2->contentInfo, |
|
| 1544 | $contentVersion2->getVersionInfo() |
|
| 1545 | ); |
|
| 1546 | /* END: Use Case */ |
|
| 1547 | ||
| 1548 | $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo); |
|
| 1549 | } |
|
| 1550 | ||
| 1551 | /** |
|
| 1552 | * Test for the publishVersion() method. |
|
| @@ 1774-1786 (lines=13) @@ | ||
| 1771 | * @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
|
| 1772 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 1773 | */ |
|
| 1774 | public function testCreateContentDraftThrowsBadStateException() |
|
| 1775 | { |
|
| 1776 | $contentService = $this->repository->getContentService(); |
|
| 1777 | $contentInfo = $contentService->loadContentInfo(4); |
|
| 1778 | $draftContent = $contentService->createContentDraft($contentInfo); |
|
| 1779 | ||
| 1780 | // Throws an exception because version status is not |
|
| 1781 | // VersionInfo::STATUS_PUBLISHED nor VersionInfo::STATUS_ARCHIVED |
|
| 1782 | $draftContent = $contentService->createContentDraft( |
|
| 1783 | $draftContent->contentInfo, |
|
| 1784 | $draftContent->getVersionInfo() |
|
| 1785 | ); |
|
| 1786 | } |
|
| 1787 | ||
| 1788 | /** |
|
| 1789 | * Test for the createContentDraft() method. |
|