Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2399-2428 (lines=30) @@
2396
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2397
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2398
     */
2399
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2400
    {
2401
        $repository = $this->getRepository();
2402
2403
        $contentService = $repository->getContentService();
2404
2405
        /* BEGIN: Use Case */
2406
        $publishedContent = $this->createContentVersion1();
2407
2408
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2409
2410
        // This content instance is identical to $draftContent
2411
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2412
            $publishedContent->contentInfo,
2413
            null,
2414
            2
2415
        );
2416
        /* END: Use Case */
2417
2418
        $this->assertEquals(
2419
            2,
2420
            $draftContentReloaded->getVersionInfo()->versionNo
2421
        );
2422
2423
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2424
        $this->assertEquals(
2425
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2426
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2427
        );
2428
    }
2429
2430
    /**
2431
     * Test for the loadContentByContentInfo() method.
@@ 2480-2502 (lines=23) @@
2477
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2478
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2479
     */
2480
    public function testLoadContentWithThirdParameter()
2481
    {
2482
        $repository = $this->getRepository();
2483
2484
        $contentService = $repository->getContentService();
2485
2486
        /* BEGIN: Use Case */
2487
        $publishedContent = $this->createContentVersion1();
2488
2489
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2490
2491
        // This content instance is identical to $draftContent
2492
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2493
        /* END: Use Case */
2494
2495
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2496
2497
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2498
        $this->assertEquals(
2499
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2500
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2501
        );
2502
    }
2503
2504
    /**
2505
     * Test for the loadContent() method.
@@ 2561-2587 (lines=27) @@
2558
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2559
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2560
     */
2561
    public function testLoadContentByRemoteIdWithThirdParameter()
2562
    {
2563
        $repository = $this->getRepository();
2564
2565
        $contentService = $repository->getContentService();
2566
2567
        /* BEGIN: Use Case */
2568
        $publishedContent = $this->createContentVersion1();
2569
2570
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2571
2572
        // This content instance is identical to $draftContent
2573
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2574
            $publishedContent->contentInfo->remoteId,
2575
            null,
2576
            2
2577
        );
2578
        /* END: Use Case */
2579
2580
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2581
2582
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2583
        $this->assertEquals(
2584
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2585
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2586
        );
2587
    }
2588
2589
    /**
2590
     * Test for the loadContentByRemoteId() method.