| @@ 1619-1640 (lines=22) @@ | ||
| 1616 | * |
|
| 1617 | * @return array |
|
| 1618 | */ |
|
| 1619 | public function testCreateContentDraft() |
|
| 1620 | { |
|
| 1621 | $time = time(); |
|
| 1622 | ||
| 1623 | /* BEGIN: Use Case */ |
|
| 1624 | $contentService = $this->repository->getContentService(); |
|
| 1625 | ||
| 1626 | $contentInfo = $contentService->loadContentInfo(4); |
|
| 1627 | ||
| 1628 | $draftContent = $contentService->createContentDraft($contentInfo); |
|
| 1629 | /* END: Use Case */ |
|
| 1630 | ||
| 1631 | $this->assertInstanceOf( |
|
| 1632 | 'eZ\\Publish\\API\\Repository\\Values\\Content\\Content', |
|
| 1633 | $draftContent |
|
| 1634 | ); |
|
| 1635 | ||
| 1636 | return [ |
|
| 1637 | 'draftContent' => $draftContent, |
|
| 1638 | 'time' => $time, |
|
| 1639 | ]; |
|
| 1640 | } |
|
| 1641 | ||
| 1642 | /** |
|
| 1643 | * @param array $data |
|
| @@ 1682-1705 (lines=24) @@ | ||
| 1679 | * |
|
| 1680 | * @return array |
|
| 1681 | */ |
|
| 1682 | public function testCreateContentDraftWithSecondArgument() |
|
| 1683 | { |
|
| 1684 | $time = time(); |
|
| 1685 | ||
| 1686 | /* BEGIN: Use Case */ |
|
| 1687 | $contentService = $this->repository->getContentService(); |
|
| 1688 | $content = $contentService->loadContent(4); |
|
| 1689 | ||
| 1690 | $draftContent = $contentService->createContentDraft( |
|
| 1691 | $content->contentInfo, |
|
| 1692 | $content->getVersionInfo() |
|
| 1693 | ); |
|
| 1694 | /* END: Use Case */ |
|
| 1695 | ||
| 1696 | $this->assertInstanceOf( |
|
| 1697 | 'eZ\\Publish\\API\\Repository\\Values\\Content\\Content', |
|
| 1698 | $draftContent |
|
| 1699 | ); |
|
| 1700 | ||
| 1701 | return [ |
|
| 1702 | 'draftContent' => $draftContent, |
|
| 1703 | 'time' => $time, |
|
| 1704 | ]; |
|
| 1705 | } |
|
| 1706 | ||
| 1707 | /** |
|
| 1708 | * Test for the createContentDraft() method. |
|
| @@ 1927-1944 (lines=18) @@ | ||
| 1924 | * |
|
| 1925 | * @return \eZ\Publish\API\Repository\Values\Content\VersionInfo[] |
|
| 1926 | */ |
|
| 1927 | public function testLoadVersionsMultiple() |
|
| 1928 | { |
|
| 1929 | $time = time(); |
|
| 1930 | ||
| 1931 | /* BEGIN: Use Case */ |
|
| 1932 | $contentService = $this->repository->getContentService(); |
|
| 1933 | ||
| 1934 | $contentInfo = $contentService->loadContentInfo(4); |
|
| 1935 | // Create one additional version |
|
| 1936 | $draftContent = $contentService->createContentDraft($contentInfo); |
|
| 1937 | $versions = $contentService->loadVersions($contentInfo); |
|
| 1938 | /* END: Use Case */ |
|
| 1939 | ||
| 1940 | return [ |
|
| 1941 | 'versions' => $versions, |
|
| 1942 | 'time' => $time, |
|
| 1943 | ]; |
|
| 1944 | } |
|
| 1945 | ||
| 1946 | /** |
|
| 1947 | * Test for the loadVersions() method. |
|