Code Duplication    Length = 19-26 lines in 3 locations

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

@@ 2760-2785 (lines=26) @@
2757
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2758
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2759
     */
2760
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2761
    {
2762
        /* BEGIN: Use Case */
2763
        $publishedContent = $this->createContentVersion1();
2764
2765
        $draftContent = $this->contentService->createContentDraft($publishedContent->contentInfo);
2766
2767
        // This content instance is identical to $draftContent
2768
        $draftContentReloaded = $this->contentService->loadContentByContentInfo(
2769
            $publishedContent->contentInfo,
2770
            null,
2771
            2
2772
        );
2773
        /* END: Use Case */
2774
2775
        $this->assertEquals(
2776
            2,
2777
            $draftContentReloaded->getVersionInfo()->versionNo
2778
        );
2779
2780
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2781
        $this->assertEquals(
2782
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2783
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2784
        );
2785
    }
2786
2787
    /**
2788
     * Test for the loadContentByContentInfo() method.
@@ 2845-2863 (lines=19) @@
2842
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2843
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2844
     */
2845
    public function testLoadContentWithThirdParameter()
2846
    {
2847
        /* BEGIN: Use Case */
2848
        $publishedContent = $this->createContentVersion1();
2849
2850
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2851
2852
        // This content instance is identical to $draftContent
2853
        $draftContentReloaded = $this->contentService->loadContent($publishedContent->id, null, 2);
2854
        /* END: Use Case */
2855
2856
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2857
2858
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2859
        $this->assertEquals(
2860
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2861
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2862
        );
2863
    }
2864
2865
    /**
2866
     * Test for the loadContent() method.
@@ 2914-2936 (lines=23) @@
2911
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2912
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2913
     */
2914
    public function testLoadContentByRemoteIdWithThirdParameter()
2915
    {
2916
        /* BEGIN: Use Case */
2917
        $publishedContent = $this->createContentVersion1();
2918
2919
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2920
2921
        // This content instance is identical to $draftContent
2922
        $draftContentReloaded = $this->contentService->loadContentByRemoteId(
2923
            $publishedContent->contentInfo->remoteId,
2924
            null,
2925
            2
2926
        );
2927
        /* END: Use Case */
2928
2929
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2930
2931
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2932
        $this->assertEquals(
2933
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2934
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2935
        );
2936
    }
2937
2938
    /**
2939
     * Test for the loadContentByRemoteId() method.