Code Duplication    Length = 19-26 lines in 3 locations

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

@@ 2626-2651 (lines=26) @@
2623
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2624
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2625
     */
2626
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2627
    {
2628
        /* BEGIN: Use Case */
2629
        $publishedContent = $this->createContentVersion1();
2630
2631
        $draftContent = $this->contentService->createContentDraft($publishedContent->contentInfo);
2632
2633
        // This content instance is identical to $draftContent
2634
        $draftContentReloaded = $this->contentService->loadContentByContentInfo(
2635
            $publishedContent->contentInfo,
2636
            null,
2637
            2
2638
        );
2639
        /* END: Use Case */
2640
2641
        $this->assertEquals(
2642
            2,
2643
            $draftContentReloaded->getVersionInfo()->versionNo
2644
        );
2645
2646
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2647
        $this->assertEquals(
2648
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2649
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2650
        );
2651
    }
2652
2653
    /**
2654
     * Test for the loadContentByContentInfo() method.
@@ 2711-2729 (lines=19) @@
2708
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2709
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2710
     */
2711
    public function testLoadContentWithThirdParameter()
2712
    {
2713
        /* BEGIN: Use Case */
2714
        $publishedContent = $this->createContentVersion1();
2715
2716
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2717
2718
        // This content instance is identical to $draftContent
2719
        $draftContentReloaded = $this->contentService->loadContent($publishedContent->id, null, 2);
2720
        /* END: Use Case */
2721
2722
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2723
2724
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2725
        $this->assertEquals(
2726
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2727
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2728
        );
2729
    }
2730
2731
    /**
2732
     * Test for the loadContent() method.
@@ 2780-2802 (lines=23) @@
2777
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2778
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2779
     */
2780
    public function testLoadContentByRemoteIdWithThirdParameter()
2781
    {
2782
        /* BEGIN: Use Case */
2783
        $publishedContent = $this->createContentVersion1();
2784
2785
        $this->contentService->createContentDraft($publishedContent->contentInfo);
2786
2787
        // This content instance is identical to $draftContent
2788
        $draftContentReloaded = $this->contentService->loadContentByRemoteId(
2789
            $publishedContent->contentInfo->remoteId,
2790
            null,
2791
            2
2792
        );
2793
        /* END: Use Case */
2794
2795
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2796
2797
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2798
        $this->assertEquals(
2799
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2800
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2801
        );
2802
    }
2803
2804
    /**
2805
     * Test for the loadContentByRemoteId() method.