Code Duplication    Length = 18-18 lines in 5 locations

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

@@ 1349-1366 (lines=18) @@
1346
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1347
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo
1348
     */
1349
    public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft)
1350
    {
1351
        $repository = $this->getRepository();
1352
1353
        $contentService = $repository->getContentService();
1354
1355
        /* BEGIN: Use Case */
1356
        $content = $this->createContentVersion1();
1357
1358
        // Now we create a new draft from the published content
1359
        $contentService->createContentDraft($content->contentInfo);
1360
1361
        // This call will still load the published version
1362
        $versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo);
1363
        /* END: Use Case */
1364
1365
        $this->assertEquals(1, $versionInfoPublished->versionNo);
1366
    }
1367
1368
    /**
1369
     * Test for the createContentDraft() method.
@@ 1375-1392 (lines=18) @@
1372
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent
1373
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1374
     */
1375
    public function testCreateContentDraftLoadContentStillLoadsPublishedVersion()
1376
    {
1377
        $repository = $this->getRepository();
1378
1379
        $contentService = $repository->getContentService();
1380
1381
        /* BEGIN: Use Case */
1382
        $content = $this->createContentVersion1();
1383
1384
        // Now we create a new draft from the published content
1385
        $contentService->createContentDraft($content->contentInfo);
1386
1387
        // This call will still load the published content version
1388
        $contentPublished = $contentService->loadContent($content->id);
1389
        /* END: Use Case */
1390
1391
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1392
    }
1393
1394
    /**
1395
     * Test for the createContentDraft() method.
@@ 1401-1418 (lines=18) @@
1398
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId
1399
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1400
     */
1401
    public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion()
1402
    {
1403
        $repository = $this->getRepository();
1404
1405
        $contentService = $repository->getContentService();
1406
1407
        /* BEGIN: Use Case */
1408
        $content = $this->createContentVersion1();
1409
1410
        // Now we create a new draft from the published content
1411
        $contentService->createContentDraft($content->contentInfo);
1412
1413
        // This call will still load the published content version
1414
        $contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789');
1415
        /* END: Use Case */
1416
1417
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1418
    }
1419
1420
    /**
1421
     * Test for the createContentDraft() method.
@@ 1427-1444 (lines=18) @@
1424
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo
1425
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft
1426
     */
1427
    public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion()
1428
    {
1429
        $repository = $this->getRepository();
1430
1431
        $contentService = $repository->getContentService();
1432
1433
        /* BEGIN: Use Case */
1434
        $content = $this->createContentVersion1();
1435
1436
        // Now we create a new draft from the published content
1437
        $contentService->createContentDraft($content->contentInfo);
1438
1439
        // This call will still load the published content version
1440
        $contentPublished = $contentService->loadContentByContentInfo($content->contentInfo);
1441
        /* END: Use Case */
1442
1443
        $this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo);
1444
    }
1445
1446
    /**
1447
     * Test for the newContentUpdateStruct() method.
@@ 1823-1840 (lines=18) @@
1820
     * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo)
1821
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent
1822
     */
1823
    public function testCreateContentDraftWithSecondParameter()
1824
    {
1825
        $repository = $this->getRepository();
1826
1827
        $contentService = $repository->getContentService();
1828
1829
        /* BEGIN: Use Case */
1830
        $contentVersion2 = $this->createContentVersion2();
1831
1832
        // Now we create a new draft from the initial version
1833
        $draftedContentReloaded = $contentService->createContentDraft(
1834
            $contentVersion2->contentInfo,
1835
            $contentVersion2->getVersionInfo()
1836
        );
1837
        /* END: Use Case */
1838
1839
        $this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo);
1840
    }
1841
1842
    /**
1843
     * Test for the createContentDraft() method with third parameter.