Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2846-2875 (lines=30) @@
2843
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2844
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2845
     */
2846
    public function testLoadContentByContentInfoWithVersionNumberParameter()
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->loadContentByContentInfo(
2859
            $publishedContent->contentInfo,
2860
            null,
2861
            2
2862
        );
2863
        /* END: Use Case */
2864
2865
        $this->assertEquals(
2866
            2,
2867
            $draftContentReloaded->getVersionInfo()->versionNo
2868
        );
2869
2870
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2871
        $this->assertEquals(
2872
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2873
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2874
        );
2875
    }
2876
2877
    /**
2878
     * Test for the loadContentByContentInfo() method.
@@ 2946-2968 (lines=23) @@
2943
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2944
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2945
     */
2946
    public function testLoadContentWithThirdParameter()
2947
    {
2948
        $repository = $this->getRepository();
2949
2950
        $contentService = $repository->getContentService();
2951
2952
        /* BEGIN: Use Case */
2953
        $publishedContent = $this->createContentVersion1();
2954
2955
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2956
2957
        // This content instance is identical to $draftContent
2958
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2959
        /* END: Use Case */
2960
2961
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2962
2963
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2964
        $this->assertEquals(
2965
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2966
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2967
        );
2968
    }
2969
2970
    /**
2971
     * Test for the loadContent() method.
@@ 3027-3053 (lines=27) @@
3024
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
3025
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
3026
     */
3027
    public function testLoadContentByRemoteIdWithThirdParameter()
3028
    {
3029
        $repository = $this->getRepository();
3030
3031
        $contentService = $repository->getContentService();
3032
3033
        /* BEGIN: Use Case */
3034
        $publishedContent = $this->createContentVersion1();
3035
3036
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
3037
3038
        // This content instance is identical to $draftContent
3039
        $draftContentReloaded = $contentService->loadContentByRemoteId(
3040
            $publishedContent->contentInfo->remoteId,
3041
            null,
3042
            2
3043
        );
3044
        /* END: Use Case */
3045
3046
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
3047
3048
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
3049
        $this->assertEquals(
3050
            $publishedContent->versionInfo->contentInfo->mainLocationId,
3051
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
3052
        );
3053
    }
3054
3055
    /**
3056
     * Test for the loadContentByRemoteId() method.