Code Duplication    Length = 23-30 lines in 3 locations

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

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