Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2854-2883 (lines=30) @@
2851
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2852
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2853
     */
2854
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2855
    {
2856
        $repository = $this->getRepository();
2857
2858
        $contentService = $repository->getContentService();
2859
2860
        /* BEGIN: Use Case */
2861
        $publishedContent = $this->createContentVersion1();
2862
2863
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2864
2865
        // This content instance is identical to $draftContent
2866
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2867
            $publishedContent->contentInfo,
2868
            null,
2869
            2
2870
        );
2871
        /* END: Use Case */
2872
2873
        $this->assertEquals(
2874
            2,
2875
            $draftContentReloaded->getVersionInfo()->versionNo
2876
        );
2877
2878
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2879
        $this->assertEquals(
2880
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2881
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2882
        );
2883
    }
2884
2885
    /**
2886
     * Test for the loadContentByContentInfo() method.
@@ 2954-2976 (lines=23) @@
2951
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2952
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2953
     */
2954
    public function testLoadContentWithThirdParameter()
2955
    {
2956
        $repository = $this->getRepository();
2957
2958
        $contentService = $repository->getContentService();
2959
2960
        /* BEGIN: Use Case */
2961
        $publishedContent = $this->createContentVersion1();
2962
2963
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2964
2965
        // This content instance is identical to $draftContent
2966
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2967
        /* END: Use Case */
2968
2969
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2970
2971
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2972
        $this->assertEquals(
2973
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2974
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2975
        );
2976
    }
2977
2978
    /**
2979
     * Test for the loadContent() method.
@@ 3035-3061 (lines=27) @@
3032
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
3033
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
3034
     */
3035
    public function testLoadContentByRemoteIdWithThirdParameter()
3036
    {
3037
        $repository = $this->getRepository();
3038
3039
        $contentService = $repository->getContentService();
3040
3041
        /* BEGIN: Use Case */
3042
        $publishedContent = $this->createContentVersion1();
3043
3044
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
3045
3046
        // This content instance is identical to $draftContent
3047
        $draftContentReloaded = $contentService->loadContentByRemoteId(
3048
            $publishedContent->contentInfo->remoteId,
3049
            null,
3050
            2
3051
        );
3052
        /* END: Use Case */
3053
3054
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
3055
3056
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
3057
        $this->assertEquals(
3058
            $publishedContent->versionInfo->contentInfo->mainLocationId,
3059
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
3060
        );
3061
    }
3062
3063
    /**
3064
     * Test for the loadContentByRemoteId() method.