Code Duplication    Length = 18-18 lines in 5 locations

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

@@ 1388-1405 (lines=18) @@
1385
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1386
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo
1387
     */
1388
    public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft)
1389
    {
1390
        $repository = $this->getRepository();
1391
1392
        $contentService = $repository->getContentService();
1393
1394
        /* BEGIN: Use Case */
1395
        $content = $this->createContentVersion1();
1396
1397
        // Now we create a new draft from the published content
1398
        $contentService->createContentDraft($content->contentInfo);
1399
1400
        // This call will still load the published version
1401
        $versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo);
1402
        /* END: Use Case */
1403
1404
        $this->assertEquals(1, $versionInfoPublished->versionNo);
1405
    }
1406
1407
    /**
1408
     * Test for the createContentDraft() method.
@@ 1414-1431 (lines=18) @@
1411
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent
1412
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1413
     */
1414
    public function testCreateContentDraftLoadContentStillLoadsPublishedVersion()
1415
    {
1416
        $repository = $this->getRepository();
1417
1418
        $contentService = $repository->getContentService();
1419
1420
        /* BEGIN: Use Case */
1421
        $content = $this->createContentVersion1();
1422
1423
        // Now we create a new draft from the published content
1424
        $contentService->createContentDraft($content->contentInfo);
1425
1426
        // This call will still load the published content version
1427
        $contentPublished = $contentService->loadContent($content->id);
1428
        /* END: Use Case */
1429
1430
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1431
    }
1432
1433
    /**
1434
     * Test for the createContentDraft() method.
@@ 1440-1457 (lines=18) @@
1437
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId
1438
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1439
     */
1440
    public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion()
1441
    {
1442
        $repository = $this->getRepository();
1443
1444
        $contentService = $repository->getContentService();
1445
1446
        /* BEGIN: Use Case */
1447
        $content = $this->createContentVersion1();
1448
1449
        // Now we create a new draft from the published content
1450
        $contentService->createContentDraft($content->contentInfo);
1451
1452
        // This call will still load the published content version
1453
        $contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789');
1454
        /* END: Use Case */
1455
1456
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1457
    }
1458
1459
    /**
1460
     * Test for the createContentDraft() method.
@@ 1466-1483 (lines=18) @@
1463
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
1464
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1465
     */
1466
    public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion()
1467
    {
1468
        $repository = $this->getRepository();
1469
1470
        $contentService = $repository->getContentService();
1471
1472
        /* BEGIN: Use Case */
1473
        $content = $this->createContentVersion1();
1474
1475
        // Now we create a new draft from the published content
1476
        $contentService->createContentDraft($content->contentInfo);
1477
1478
        // This call will still load the published content version
1479
        $contentPublished = $contentService->loadContentByContentInfo($content->contentInfo);
1480
        /* END: Use Case */
1481
1482
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1483
    }
1484
1485
    /**
1486
     * Test for the newContentUpdateStruct() method.
@@ 1862-1879 (lines=18) @@
1859
     * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo)
1860
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1861
     */
1862
    public function testCreateContentDraftWithSecondParameter()
1863
    {
1864
        $repository = $this->getRepository();
1865
1866
        $contentService = $repository->getContentService();
1867
1868
        /* BEGIN: Use Case */
1869
        $contentVersion2 = $this->createContentVersion2();
1870
1871
        // Now we create a new draft from the initial version
1872
        $draftedContentReloaded = $contentService->createContentDraft(
1873
            $contentVersion2->contentInfo,
1874
            $contentVersion2->getVersionInfo()
1875
        );
1876
        /* END: Use Case */
1877
1878
        $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo);
1879
    }
1880
1881
    /**
1882
     * Test for the createContentDraft() method with third parameter.