Code Duplication    Length = 13-18 lines in 2 locations

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 1 location

@@ 1530-1547 (lines=18) @@
1527
     * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo)
1528
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1529
     */
1530
    public function testCreateContentDraftWithSecondParameter()
1531
    {
1532
        $repository = $this->getRepository();
1533
1534
        $contentService = $repository->getContentService();
1535
1536
        /* BEGIN: Use Case */
1537
        $contentVersion2 = $this->createContentVersion2();
1538
1539
        // Now we create a new draft from the initial version
1540
        $draftedContentReloaded = $contentService->createContentDraft(
1541
            $contentVersion2->contentInfo,
1542
            $contentVersion2->getVersionInfo()
1543
        );
1544
        /* END: Use Case */
1545
1546
        $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo);
1547
    }
1548
1549
    /**
1550
     * Test for the publishVersion() method.

eZ/Publish/Core/Repository/Tests/Service/Integration/ContentBase.php 1 location

@@ 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.