| @@ 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. |
|
| @@ 1741-1753 (lines=13) @@ | ||
| 1738 | * @covers \eZ\Publish\Core\Repository\ContentService::createContentDraft |
|
| 1739 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 1740 | */ |
|
| 1741 | public function testCreateContentDraftThrowsBadStateException() |
|
| 1742 | { |
|
| 1743 | $contentService = $this->repository->getContentService(); |
|
| 1744 | $contentInfo = $contentService->loadContentInfo(4); |
|
| 1745 | $draftContent = $contentService->createContentDraft($contentInfo); |
|
| 1746 | ||
| 1747 | // Throws an exception because version status is not |
|
| 1748 | // VersionInfo::STATUS_PUBLISHED nor VersionInfo::STATUS_ARCHIVED |
|
| 1749 | $draftContent = $contentService->createContentDraft( |
|
| 1750 | $draftContent->contentInfo, |
|
| 1751 | $draftContent->getVersionInfo() |
|
| 1752 | ); |
|
| 1753 | } |
|
| 1754 | ||
| 1755 | /** |
|
| 1756 | * Test for the createContentDraft() method. |
|