Code Duplication    Length = 23-30 lines in 3 locations

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

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