|
@@ 1295-1312 (lines=18) @@
|
| 1292 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1293 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo |
| 1294 |
|
*/ |
| 1295 |
|
public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft) |
| 1296 |
|
{ |
| 1297 |
|
$repository = $this->getRepository(); |
| 1298 |
|
|
| 1299 |
|
$contentService = $repository->getContentService(); |
| 1300 |
|
|
| 1301 |
|
/* BEGIN: Use Case */ |
| 1302 |
|
$content = $this->createContentVersion1(); |
| 1303 |
|
|
| 1304 |
|
// Now we create a new draft from the published content |
| 1305 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1306 |
|
|
| 1307 |
|
// This call will still load the published version |
| 1308 |
|
$versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo); |
| 1309 |
|
/* END: Use Case */ |
| 1310 |
|
|
| 1311 |
|
$this->assertEquals(1, $versionInfoPublished->versionNo); |
| 1312 |
|
} |
| 1313 |
|
|
| 1314 |
|
/** |
| 1315 |
|
* Test for the createContentDraft() method. |
|
@@ 1321-1338 (lines=18) @@
|
| 1318 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
| 1319 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1320 |
|
*/ |
| 1321 |
|
public function testCreateContentDraftLoadContentStillLoadsPublishedVersion() |
| 1322 |
|
{ |
| 1323 |
|
$repository = $this->getRepository(); |
| 1324 |
|
|
| 1325 |
|
$contentService = $repository->getContentService(); |
| 1326 |
|
|
| 1327 |
|
/* BEGIN: Use Case */ |
| 1328 |
|
$content = $this->createContentVersion1(); |
| 1329 |
|
|
| 1330 |
|
// Now we create a new draft from the published content |
| 1331 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1332 |
|
|
| 1333 |
|
// This call will still load the published content version |
| 1334 |
|
$contentPublished = $contentService->loadContent($content->id); |
| 1335 |
|
/* END: Use Case */ |
| 1336 |
|
|
| 1337 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1338 |
|
} |
| 1339 |
|
|
| 1340 |
|
/** |
| 1341 |
|
* Test for the createContentDraft() method. |
|
@@ 1347-1364 (lines=18) @@
|
| 1344 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId |
| 1345 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1346 |
|
*/ |
| 1347 |
|
public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion() |
| 1348 |
|
{ |
| 1349 |
|
$repository = $this->getRepository(); |
| 1350 |
|
|
| 1351 |
|
$contentService = $repository->getContentService(); |
| 1352 |
|
|
| 1353 |
|
/* BEGIN: Use Case */ |
| 1354 |
|
$content = $this->createContentVersion1(); |
| 1355 |
|
|
| 1356 |
|
// Now we create a new draft from the published content |
| 1357 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1358 |
|
|
| 1359 |
|
// This call will still load the published content version |
| 1360 |
|
$contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789'); |
| 1361 |
|
/* END: Use Case */ |
| 1362 |
|
|
| 1363 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1364 |
|
} |
| 1365 |
|
|
| 1366 |
|
/** |
| 1367 |
|
* Test for the createContentDraft() method. |
|
@@ 1373-1390 (lines=18) @@
|
| 1370 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo |
| 1371 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1372 |
|
*/ |
| 1373 |
|
public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion() |
| 1374 |
|
{ |
| 1375 |
|
$repository = $this->getRepository(); |
| 1376 |
|
|
| 1377 |
|
$contentService = $repository->getContentService(); |
| 1378 |
|
|
| 1379 |
|
/* BEGIN: Use Case */ |
| 1380 |
|
$content = $this->createContentVersion1(); |
| 1381 |
|
|
| 1382 |
|
// Now we create a new draft from the published content |
| 1383 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1384 |
|
|
| 1385 |
|
// This call will still load the published content version |
| 1386 |
|
$contentPublished = $contentService->loadContentByContentInfo($content->contentInfo); |
| 1387 |
|
/* END: Use Case */ |
| 1388 |
|
|
| 1389 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1390 |
|
} |
| 1391 |
|
|
| 1392 |
|
/** |
| 1393 |
|
* Test for the newContentUpdateStruct() method. |
|
@@ 1769-1786 (lines=18) @@
|
| 1766 |
|
* @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
| 1767 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
| 1768 |
|
*/ |
| 1769 |
|
public function testCreateContentDraftWithSecondParameter() |
| 1770 |
|
{ |
| 1771 |
|
$repository = $this->getRepository(); |
| 1772 |
|
|
| 1773 |
|
$contentService = $repository->getContentService(); |
| 1774 |
|
|
| 1775 |
|
/* BEGIN: Use Case */ |
| 1776 |
|
$contentVersion2 = $this->createContentVersion2(); |
| 1777 |
|
|
| 1778 |
|
// Now we create a new draft from the initial version |
| 1779 |
|
$draftedContentReloaded = $contentService->createContentDraft( |
| 1780 |
|
$contentVersion2->contentInfo, |
| 1781 |
|
$contentVersion2->getVersionInfo() |
| 1782 |
|
); |
| 1783 |
|
/* END: Use Case */ |
| 1784 |
|
|
| 1785 |
|
$this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo); |
| 1786 |
|
} |
| 1787 |
|
|
| 1788 |
|
/** |
| 1789 |
|
* Test for the createContentDraft() method with third parameter. |