Code Duplication    Length = 18-18 lines in 5 locations

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

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