Code Duplication    Length = 23-30 lines in 3 locations

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

@@ 2328-2357 (lines=30) @@
2325
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo)
2326
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
2327
     */
2328
    public function testLoadContentByContentInfoWithVersionNumberParameter()
2329
    {
2330
        $repository = $this->getRepository();
2331
2332
        $contentService = $repository->getContentService();
2333
2334
        /* BEGIN: Use Case */
2335
        $publishedContent = $this->createContentVersion1();
2336
2337
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2338
2339
        // This content instance is identical to $draftContent
2340
        $draftContentReloaded = $contentService->loadContentByContentInfo(
2341
            $publishedContent->contentInfo,
2342
            null,
2343
            2
2344
        );
2345
        /* END: Use Case */
2346
2347
        $this->assertEquals(
2348
            2,
2349
            $draftContentReloaded->getVersionInfo()->versionNo
2350
        );
2351
2352
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2353
        $this->assertEquals(
2354
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2355
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2356
        );
2357
    }
2358
2359
    /**
2360
     * Test for the loadContentByContentInfo() method.
@@ 2409-2431 (lines=23) @@
2406
     * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo)
2407
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2408
     */
2409
    public function testLoadContentWithThirdParameter()
2410
    {
2411
        $repository = $this->getRepository();
2412
2413
        $contentService = $repository->getContentService();
2414
2415
        /* BEGIN: Use Case */
2416
        $publishedContent = $this->createContentVersion1();
2417
2418
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2419
2420
        // This content instance is identical to $draftContent
2421
        $draftContentReloaded = $contentService->loadContent($publishedContent->id, null, 2);
2422
        /* END: Use Case */
2423
2424
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2425
2426
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2427
        $this->assertEquals(
2428
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2429
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2430
        );
2431
    }
2432
2433
    /**
2434
     * Test for the loadContent() method.
@@ 2490-2516 (lines=27) @@
2487
     * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo)
2488
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft
2489
     */
2490
    public function testLoadContentByRemoteIdWithThirdParameter()
2491
    {
2492
        $repository = $this->getRepository();
2493
2494
        $contentService = $repository->getContentService();
2495
2496
        /* BEGIN: Use Case */
2497
        $publishedContent = $this->createContentVersion1();
2498
2499
        $draftContent = $contentService->createContentDraft($publishedContent->contentInfo);
2500
2501
        // This content instance is identical to $draftContent
2502
        $draftContentReloaded = $contentService->loadContentByRemoteId(
2503
            $publishedContent->contentInfo->remoteId,
2504
            null,
2505
            2
2506
        );
2507
        /* END: Use Case */
2508
2509
        $this->assertEquals(2, $draftContentReloaded->getVersionInfo()->versionNo);
2510
2511
        // Check that ContentInfo contained in reloaded draft Content has correct main Location id set
2512
        $this->assertEquals(
2513
            $publishedContent->versionInfo->contentInfo->mainLocationId,
2514
            $draftContentReloaded->versionInfo->contentInfo->mainLocationId
2515
        );
2516
    }
2517
2518
    /**
2519
     * Test for the loadContentByRemoteId() method.