Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2689-2718 (lines=30) @@
2686
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2687
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2688
     */
2689
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2690
    {
2691
        $repository = $this->getRepository();
2692
2693
        $contentService = $repository->getContentService();
2694
2695
        /* BEGIN: Use Case */
2696
        $publishedContent = $this->createContentVersion1();
2697
2698
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2699
2700
        // This content instance is identical to $draftContent
2701
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2702
            $publishedContent->contentInfo,
2703
            null,
2704
            2
2705
        );
2706
        /* END: Use Case */
2707
2708
        $this->assertEquals(
2709
            2,
2710
            $draftContentReloaded->getVersionInfo()->versionNo
2711
        );
2712
2713
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2714
        $this->assertEquals(
2715
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2716
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2717
        );
2718
    }
2719
2720
    /**
2721
     * Test for the loadContentByContentInfo() method.
@@ 2789-2811 (lines=23) @@
2786
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2787
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2788
     */
2789
    public function testLoadContentWithThirdParameter()
2790
    {
2791
        $repository = $this->getRepository();
2792
2793
        $contentService = $repository->getContentService();
2794
2795
        /* BEGIN: Use Case */
2796
        $publishedContent = $this->createContentVersion1();
2797
2798
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2799
2800
        // This content instance is identical to $draftContent
2801
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2802
        /* END: Use Case */
2803
2804
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2805
2806
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2807
        $this->assertEquals(
2808
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2809
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2810
        );
2811
    }
2812
2813
    /**
2814
     * Test for the loadContent() method.
@@ 2870-2896 (lines=27) @@
2867
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2868
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2869
     */
2870
    public function testLoadContentByRemoteIdWithThirdParameter()
2871
    {
2872
        $repository = $this->getRepository();
2873
2874
        $contentService = $repository->getContentService();
2875
2876
        /* BEGIN: Use Case */
2877
        $publishedContent = $this->createContentVersion1();
2878
2879
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2880
2881
        // This content instance is identical to $draftContent
2882
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2883
            $publishedContent->contentInfo->remoteId,
2884
            null,
2885
            2
2886
        );
2887
        /* END: Use Case */
2888
2889
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2890
2891
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2892
        $this->assertEquals(
2893
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2894
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2895
        );
2896
    }
2897
2898
    /**
2899
     * Test for the loadContentByRemoteId() method.