Code Duplication    Length = 19-26 lines in 3 locations

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 3 locations

@@ 2726-2751 (lines=26) @@
2723
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2724
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2725
     */
2726
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2727
    {
2728
        /* BEGIN: Use Case */
2729
        $publishedContent = $this->createContentVersion1();
2730
2731
        $draftContent = $this->contentService->createContentDraft($publishedContent->contentInfo);
2732
2733
        // This content instance is identical to $draftContent
2734
        $draftContentReloaded = $this->contentService->loadContentByContentInfo(
2735
            $publishedContent->contentInfo,
2736
            null,
2737
            2
2738
        );
2739
        /* END: Use Case */
2740
2741
        $this->assertEquals(
2742
            2,
2743
            $draftContentReloaded->getVersionInfo()->versionNo
2744
        );
2745
2746
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2747
        $this->assertEquals(
2748
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2749
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2750
        );
2751
    }
2752
2753
    /**
2754
     * Test for the loadContentByContentInfo() method.
@@ 2811-2829 (lines=19) @@
2808
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2809
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2810
     */
2811
    public function testLoadContentWithThirdParameter()
2812
    {
2813
        /* BEGIN: Use Case */
2814
        $publishedContent = $this->createContentVersion1();
2815
2816
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2817
2818
        // This content instance is identical to $draftContent
2819
        $draftContentReloaded = $this->contentService->loadContent($publishedContent->id, null, 2);
2820
        /* END: Use Case */
2821
2822
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2823
2824
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2825
        $this->assertEquals(
2826
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2827
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2828
        );
2829
    }
2830
2831
    /**
2832
     * Test for the loadContent() method.
@@ 2880-2902 (lines=23) @@
2877
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2878
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2879
     */
2880
    public function testLoadContentByRemoteIdWithThirdParameter()
2881
    {
2882
        /* BEGIN: Use Case */
2883
        $publishedContent = $this->createContentVersion1();
2884
2885
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2886
2887
        // This content instance is identical to $draftContent
2888
        $draftContentReloaded = $this->contentService->loadContentByRemoteId(
2889
            $publishedContent->contentInfo->remoteId,
2890
            null,
2891
            2
2892
        );
2893
        /* END: Use Case */
2894
2895
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2896
2897
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2898
        $this->assertEquals(
2899
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2900
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2901
        );
2902
    }
2903
2904
    /**
2905
     * Test for the loadContentByRemoteId() method.