Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2446-2475 (lines=30) @@
2443
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2444
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2445
     */
2446
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2447
    {
2448
        $repository = $this->getRepository();
2449
2450
        $contentService = $repository->getContentService();
2451
2452
        /* BEGIN: Use Case */
2453
        $publishedContent = $this->createContentVersion1();
2454
2455
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2456
2457
        // This content instance is identical to $draftContent
2458
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2459
            $publishedContent->contentInfo,
2460
            null,
2461
            2
2462
        );
2463
        /* END: Use Case */
2464
2465
        $this->assertEquals(
2466
            2,
2467
            $draftContentReloaded->getVersionInfo()->versionNo
2468
        );
2469
2470
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2471
        $this->assertEquals(
2472
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2473
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2474
        );
2475
    }
2476
2477
    /**
2478
     * Test for the loadContentByContentInfo() method.
@@ 2527-2549 (lines=23) @@
2524
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2525
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2526
     */
2527
    public function testLoadContentWithThirdParameter()
2528
    {
2529
        $repository = $this->getRepository();
2530
2531
        $contentService = $repository->getContentService();
2532
2533
        /* BEGIN: Use Case */
2534
        $publishedContent = $this->createContentVersion1();
2535
2536
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2537
2538
        // This content instance is identical to $draftContent
2539
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2540
        /* END: Use Case */
2541
2542
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2543
2544
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2545
        $this->assertEquals(
2546
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2547
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2548
        );
2549
    }
2550
2551
    /**
2552
     * Test for the loadContent() method.
@@ 2608-2634 (lines=27) @@
2605
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2606
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2607
     */
2608
    public function testLoadContentByRemoteIdWithThirdParameter()
2609
    {
2610
        $repository = $this->getRepository();
2611
2612
        $contentService = $repository->getContentService();
2613
2614
        /* BEGIN: Use Case */
2615
        $publishedContent = $this->createContentVersion1();
2616
2617
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2618
2619
        // This content instance is identical to $draftContent
2620
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2621
            $publishedContent->contentInfo->remoteId,
2622
            null,
2623
            2
2624
        );
2625
        /* END: Use Case */
2626
2627
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2628
2629
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2630
        $this->assertEquals(
2631
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2632
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2633
        );
2634
    }
2635
2636
    /**
2637
     * Test for the loadContentByRemoteId() method.