Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2391-2420 (lines=30) @@
2388
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2389
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2390
     */
2391
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2392
    {
2393
        $repository = $this->getRepository();
2394
2395
        $contentService = $repository->getContentService();
2396
2397
        /* BEGIN: Use Case */
2398
        $publishedContent = $this->createContentVersion1();
2399
2400
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2401
2402
        // This content instance is identical to $draftContent
2403
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2404
            $publishedContent->contentInfo,
2405
            null,
2406
            2
2407
        );
2408
        /* END: Use Case */
2409
2410
        $this->assertEquals(
2411
            2,
2412
            $draftContentReloaded->getVersionInfo()->versionNo
2413
        );
2414
2415
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2416
        $this->assertEquals(
2417
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2418
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2419
        );
2420
    }
2421
2422
    /**
2423
     * Test for the loadContentByContentInfo() method.
@@ 2472-2494 (lines=23) @@
2469
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2470
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2471
     */
2472
    public function testLoadContentWithThirdParameter()
2473
    {
2474
        $repository = $this->getRepository();
2475
2476
        $contentService = $repository->getContentService();
2477
2478
        /* BEGIN: Use Case */
2479
        $publishedContent = $this->createContentVersion1();
2480
2481
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2482
2483
        // This content instance is identical to $draftContent
2484
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2485
        /* END: Use Case */
2486
2487
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2488
2489
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2490
        $this->assertEquals(
2491
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2492
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2493
        );
2494
    }
2495
2496
    /**
2497
     * Test for the loadContent() method.
@@ 2553-2579 (lines=27) @@
2550
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2551
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2552
     */
2553
    public function testLoadContentByRemoteIdWithThirdParameter()
2554
    {
2555
        $repository = $this->getRepository();
2556
2557
        $contentService = $repository->getContentService();
2558
2559
        /* BEGIN: Use Case */
2560
        $publishedContent = $this->createContentVersion1();
2561
2562
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2563
2564
        // This content instance is identical to $draftContent
2565
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2566
            $publishedContent->contentInfo->remoteId,
2567
            null,
2568
            2
2569
        );
2570
        /* END: Use Case */
2571
2572
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2573
2574
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2575
        $this->assertEquals(
2576
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2577
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2578
        );
2579
    }
2580
2581
    /**
2582
     * Test for the loadContentByRemoteId() method.