Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2656-2685 (lines=30) @@
2653
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2654
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2655
     */
2656
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2657
    {
2658
        $repository = $this->getRepository();
2659
2660
        $contentService = $repository->getContentService();
2661
2662
        /* BEGIN: Use Case */
2663
        $publishedContent = $this->createContentVersion1();
2664
2665
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2666
2667
        // This content instance is identical to $draftContent
2668
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2669
            $publishedContent->contentInfo,
2670
            null,
2671
            2
2672
        );
2673
        /* END: Use Case */
2674
2675
        $this->assertEquals(
2676
            2,
2677
            $draftContentReloaded->getVersionInfo()->versionNo
2678
        );
2679
2680
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2681
        $this->assertEquals(
2682
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2683
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2684
        );
2685
    }
2686
2687
    /**
2688
     * Test for the loadContentByContentInfo() method.
@@ 2756-2778 (lines=23) @@
2753
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2754
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2755
     */
2756
    public function testLoadContentWithThirdParameter()
2757
    {
2758
        $repository = $this->getRepository();
2759
2760
        $contentService = $repository->getContentService();
2761
2762
        /* BEGIN: Use Case */
2763
        $publishedContent = $this->createContentVersion1();
2764
2765
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2766
2767
        // This content instance is identical to $draftContent
2768
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2769
        /* END: Use Case */
2770
2771
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
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 loadContent() method.
@@ 2837-2863 (lines=27) @@
2834
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2835
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2836
     */
2837
    public function testLoadContentByRemoteIdWithThirdParameter()
2838
    {
2839
        $repository = $this->getRepository();
2840
2841
        $contentService = $repository->getContentService();
2842
2843
        /* BEGIN: Use Case */
2844
        $publishedContent = $this->createContentVersion1();
2845
2846
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2847
2848
        // This content instance is identical to $draftContent
2849
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2850
            $publishedContent->contentInfo->remoteId,
2851
            null,
2852
            2
2853
        );
2854
        /* END: Use Case */
2855
2856
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2857
2858
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2859
        $this->assertEquals(
2860
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2861
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2862
        );
2863
    }
2864
2865
    /**
2866
     * Test for the loadContentByRemoteId() method.