Code Duplication    Length = 18-25 lines in 2 locations

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

@@ 1897-1921 (lines=25) @@
1894
     * @see \eZ\Publish\API\Repository\ContentService::publishVersion()
1895
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
1896
     */
1897
    public function testPublishVersionFromOldContentDraftArchivesNewerVersionNo()
1898
    {
1899
        $repository = $this->getRepository();
1900
1901
        $contentService = $repository->getContentService();
1902
1903
        /* BEGIN: Use Case */
1904
        $content = $this->createContentVersion1();
1905
1906
        // Create a new draft with versionNo = 2
1907
        $draftedContentVersion2 = $contentService->createContentDraft($content->contentInfo);
1908
1909
        // Create another new draft with versionNo = 3
1910
        $draftedContentVersion3 = $contentService->createContentDraft($content->contentInfo);
1911
1912
        // Publish draft with versionNo = 3
1913
        $contentService->publishVersion($draftedContentVersion3->getVersionInfo());
1914
1915
        // Publish the first draft with versionNo = 2
1916
        // currentVersionNo is now 2, versionNo 3 will be archived
1917
        $publishedDraft = $contentService->publishVersion($draftedContentVersion2->getVersionInfo());
1918
        /* END: Use Case */
1919
1920
        $this->assertEquals(2, $publishedDraft->contentInfo->currentVersionNo);
1921
    }
1922
1923
    /**
1924
     * Test for the publishVersion() method, and that it creates limited archives.

eZ/Publish/API/Repository/Tests/FieldType/RichTextIntegrationTest.php 1 location

@@ 778-795 (lines=18) @@
775
     * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException
776
     * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException
777
     */
778
    public function testInternalLinkValidatorIgnoresMissingRelationOnNotUpdatedField()
779
    {
780
        $repository = $this->getRepository();
781
        $contentService = $repository->getContentService();
782
783
        list(, $contentB) = $this->prepareInternalLinkValidatorBrokenLinksTestCase($repository);
784
785
        // update field w/o erroneous link to trigger validation
786
        $contentUpdateStruct = $contentService->newContentUpdateStruct();
787
        $contentUpdateStruct->setField('data', $this->getValidUpdateFieldData(), 'eng-US');
788
789
        $contentDraftB = $contentService->updateContent(
790
            $contentService->createContentDraft($contentB->contentInfo)->versionInfo,
791
            $contentUpdateStruct
792
        );
793
794
        $contentService->publishVersion($contentDraftB->versionInfo);
795
    }
796
797
    /**
798
     * Test updating Content which contains links to deleted Location fails when updating broken field.