Code Duplication    Length = 23-30 lines in 3 locations

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

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