Code Duplication    Length = 23-30 lines in 3 locations

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

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