Code Duplication    Length = 23-30 lines in 3 locations

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

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