Code Duplication    Length = 18-18 lines in 5 locations

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

@@ 1400-1417 (lines=18) @@
1397
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1398
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo
1399
     */
1400
    public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft)
1401
    {
1402
        $repository = $this->getRepository();
1403
1404
        $contentService = $repository->getContentService();
1405
1406
        /* BEGIN: Use Case */
1407
        $content = $this->createContentVersion1();
1408
1409
        // Now we create a new draft from the published content
1410
        $contentService->createContentDraft($content->contentInfo);
1411
1412
        // This call will still load the published version
1413
        $versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo);
1414
        /* END: Use Case */
1415
1416
        $this->assertEquals(1, $versionInfoPublished->versionNo);
1417
    }
1418
1419
    /**
1420
     * Test for the createContentDraft() method.
@@ 1426-1443 (lines=18) @@
1423
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent
1424
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1425
     */
1426
    public function testCreateContentDraftLoadContentStillLoadsPublishedVersion()
1427
    {
1428
        $repository = $this->getRepository();
1429
1430
        $contentService = $repository->getContentService();
1431
1432
        /* BEGIN: Use Case */
1433
        $content = $this->createContentVersion1();
1434
1435
        // Now we create a new draft from the published content
1436
        $contentService->createContentDraft($content->contentInfo);
1437
1438
        // This call will still load the published content version
1439
        $contentPublished = $contentService->loadContent($content->id);
1440
        /* END: Use Case */
1441
1442
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1443
    }
1444
1445
    /**
1446
     * Test for the createContentDraft() method.
@@ 1452-1469 (lines=18) @@
1449
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId
1450
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1451
     */
1452
    public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion()
1453
    {
1454
        $repository = $this->getRepository();
1455
1456
        $contentService = $repository->getContentService();
1457
1458
        /* BEGIN: Use Case */
1459
        $content = $this->createContentVersion1();
1460
1461
        // Now we create a new draft from the published content
1462
        $contentService->createContentDraft($content->contentInfo);
1463
1464
        // This call will still load the published content version
1465
        $contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789');
1466
        /* END: Use Case */
1467
1468
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1469
    }
1470
1471
    /**
1472
     * Test for the createContentDraft() method.
@@ 1478-1495 (lines=18) @@
1475
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
1476
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1477
     */
1478
    public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion()
1479
    {
1480
        $repository = $this->getRepository();
1481
1482
        $contentService = $repository->getContentService();
1483
1484
        /* BEGIN: Use Case */
1485
        $content = $this->createContentVersion1();
1486
1487
        // Now we create a new draft from the published content
1488
        $contentService->createContentDraft($content->contentInfo);
1489
1490
        // This call will still load the published content version
1491
        $contentPublished = $contentService->loadContentByContentInfo($content->contentInfo);
1492
        /* END: Use Case */
1493
1494
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1495
    }
1496
1497
    /**
1498
     * Test for the newContentUpdateStruct() method.
@@ 1878-1895 (lines=18) @@
1875
     * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo)
1876
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1877
     */
1878
    public function testCreateContentDraftWithSecondParameter()
1879
    {
1880
        $repository = $this->getRepository();
1881
1882
        $contentService = $repository->getContentService();
1883
1884
        /* BEGIN: Use Case */
1885
        $contentVersion2 = $this->createContentVersion2();
1886
1887
        // Now we create a new draft from the initial version
1888
        $draftedContentReloaded = $contentService->createContentDraft(
1889
            $contentVersion2->contentInfo,
1890
            $contentVersion2->getVersionInfo()
1891
        );
1892
        /* END: Use Case */
1893
1894
        $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo);
1895
    }
1896
1897
    /**
1898
     * Test for the createContentDraft() method with third parameter.