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