Code Duplication    Length = 23-30 lines in 3 locations

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

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