Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2869-2898 (lines=30) @@
2866
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2867
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2868
     */
2869
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2870
    {
2871
        $repository = $this->getRepository();
2872
2873
        $contentService = $repository->getContentService();
2874
2875
        /* BEGIN: Use Case */
2876
        $publishedContent = $this->createContentVersion1();
2877
2878
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2879
2880
        // This content instance is identical to $draftContent
2881
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2882
            $publishedContent->contentInfo,
2883
            null,
2884
            2
2885
        );
2886
        /* END: Use Case */
2887
2888
        $this->assertEquals(
2889
            2,
2890
            $draftContentReloaded->getVersionInfo()->versionNo
2891
        );
2892
2893
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2894
        $this->assertEquals(
2895
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2896
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2897
        );
2898
    }
2899
2900
    /**
2901
     * Test for the loadContentByContentInfo() method.
@@ 2971-2993 (lines=23) @@
2968
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2969
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2970
     */
2971
    public function testLoadContentWithThirdParameter()
2972
    {
2973
        $repository = $this->getRepository();
2974
2975
        $contentService = $repository->getContentService();
2976
2977
        /* BEGIN: Use Case */
2978
        $publishedContent = $this->createContentVersion1();
2979
2980
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2981
2982
        // This content instance is identical to $draftContent
2983
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2984
        /* END: Use Case */
2985
2986
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2987
2988
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2989
        $this->assertEquals(
2990
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2991
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2992
        );
2993
    }
2994
2995
    /**
2996
     * Test for the loadContent() method.
@@ 3053-3079 (lines=27) @@
3050
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
3051
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
3052
     */
3053
    public function testLoadContentByRemoteIdWithThirdParameter()
3054
    {
3055
        $repository = $this->getRepository();
3056
3057
        $contentService = $repository->getContentService();
3058
3059
        /* BEGIN: Use Case */
3060
        $publishedContent = $this->createContentVersion1();
3061
3062
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
3063
3064
        // This content instance is identical to $draftContent
3065
        $draftContentReloaded = $contentService->loadContentByRemoteId(
3066
            $publishedContent->contentInfo->remoteId,
3067
            null,
3068
            2
3069
        );
3070
        /* END: Use Case */
3071
3072
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
3073
3074
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
3075
        $this->assertEquals(
3076
            $publishedContent->versionInfo->contentInfo->mainLocationId,
3077
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
3078
        );
3079
    }
3080
3081
    /**
3082
     * Test for the loadContentByRemoteId() method.