Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2746-2775 (lines=30) @@
2743
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2744
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2745
     */
2746
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2747
    {
2748
        $repository = $this->getRepository();
2749
2750
        $contentService = $repository->getContentService();
2751
2752
        /* BEGIN: Use Case */
2753
        $publishedContent = $this->createContentVersion1();
2754
2755
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2756
2757
        // This content instance is identical to $draftContent
2758
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2759
            $publishedContent->contentInfo,
2760
            null,
2761
            2
2762
        );
2763
        /* END: Use Case */
2764
2765
        $this->assertEquals(
2766
            2,
2767
            $draftContentReloaded->getVersionInfo()->versionNo
2768
        );
2769
2770
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2771
        $this->assertEquals(
2772
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2773
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2774
        );
2775
    }
2776
2777
    /**
2778
     * Test for the loadContentByContentInfo() method.
@@ 2846-2868 (lines=23) @@
2843
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2844
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2845
     */
2846
    public function testLoadContentWithThirdParameter()
2847
    {
2848
        $repository = $this->getRepository();
2849
2850
        $contentService = $repository->getContentService();
2851
2852
        /* BEGIN: Use Case */
2853
        $publishedContent = $this->createContentVersion1();
2854
2855
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2856
2857
        // This content instance is identical to $draftContent
2858
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2859
        /* END: Use Case */
2860
2861
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2862
2863
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2864
        $this->assertEquals(
2865
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2866
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2867
        );
2868
    }
2869
2870
    /**
2871
     * Test for the loadContent() method.
@@ 2927-2953 (lines=27) @@
2924
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2925
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2926
     */
2927
    public function testLoadContentByRemoteIdWithThirdParameter()
2928
    {
2929
        $repository = $this->getRepository();
2930
2931
        $contentService = $repository->getContentService();
2932
2933
        /* BEGIN: Use Case */
2934
        $publishedContent = $this->createContentVersion1();
2935
2936
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2937
2938
        // This content instance is identical to $draftContent
2939
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2940
            $publishedContent->contentInfo->remoteId,
2941
            null,
2942
            2
2943
        );
2944
        /* END: Use Case */
2945
2946
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2947
2948
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2949
        $this->assertEquals(
2950
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2951
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2952
        );
2953
    }
2954
2955
    /**
2956
     * Test for the loadContentByRemoteId() method.