|
@@ 1291-1308 (lines=18) @@
|
| 1288 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1289 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo |
| 1290 |
|
*/ |
| 1291 |
|
public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft) |
| 1292 |
|
{ |
| 1293 |
|
$repository = $this->getRepository(); |
| 1294 |
|
|
| 1295 |
|
$contentService = $repository->getContentService(); |
| 1296 |
|
|
| 1297 |
|
/* BEGIN: Use Case */ |
| 1298 |
|
$content = $this->createContentVersion1(); |
| 1299 |
|
|
| 1300 |
|
// Now we create a new draft from the published content |
| 1301 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1302 |
|
|
| 1303 |
|
// This call will still load the published version |
| 1304 |
|
$versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo); |
| 1305 |
|
/* END: Use Case */ |
| 1306 |
|
|
| 1307 |
|
$this->assertEquals(1, $versionInfoPublished->versionNo); |
| 1308 |
|
} |
| 1309 |
|
|
| 1310 |
|
/** |
| 1311 |
|
* Test for the createContentDraft() method. |
|
@@ 1317-1334 (lines=18) @@
|
| 1314 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
| 1315 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1316 |
|
*/ |
| 1317 |
|
public function testCreateContentDraftLoadContentStillLoadsPublishedVersion() |
| 1318 |
|
{ |
| 1319 |
|
$repository = $this->getRepository(); |
| 1320 |
|
|
| 1321 |
|
$contentService = $repository->getContentService(); |
| 1322 |
|
|
| 1323 |
|
/* BEGIN: Use Case */ |
| 1324 |
|
$content = $this->createContentVersion1(); |
| 1325 |
|
|
| 1326 |
|
// Now we create a new draft from the published content |
| 1327 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1328 |
|
|
| 1329 |
|
// This call will still load the published content version |
| 1330 |
|
$contentPublished = $contentService->loadContent($content->id); |
| 1331 |
|
/* END: Use Case */ |
| 1332 |
|
|
| 1333 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1334 |
|
} |
| 1335 |
|
|
| 1336 |
|
/** |
| 1337 |
|
* Test for the createContentDraft() method. |
|
@@ 1343-1360 (lines=18) @@
|
| 1340 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId |
| 1341 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1342 |
|
*/ |
| 1343 |
|
public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion() |
| 1344 |
|
{ |
| 1345 |
|
$repository = $this->getRepository(); |
| 1346 |
|
|
| 1347 |
|
$contentService = $repository->getContentService(); |
| 1348 |
|
|
| 1349 |
|
/* BEGIN: Use Case */ |
| 1350 |
|
$content = $this->createContentVersion1(); |
| 1351 |
|
|
| 1352 |
|
// Now we create a new draft from the published content |
| 1353 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1354 |
|
|
| 1355 |
|
// This call will still load the published content version |
| 1356 |
|
$contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789'); |
| 1357 |
|
/* END: Use Case */ |
| 1358 |
|
|
| 1359 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1360 |
|
} |
| 1361 |
|
|
| 1362 |
|
/** |
| 1363 |
|
* Test for the createContentDraft() method. |
|
@@ 1369-1386 (lines=18) @@
|
| 1366 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo |
| 1367 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1368 |
|
*/ |
| 1369 |
|
public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion() |
| 1370 |
|
{ |
| 1371 |
|
$repository = $this->getRepository(); |
| 1372 |
|
|
| 1373 |
|
$contentService = $repository->getContentService(); |
| 1374 |
|
|
| 1375 |
|
/* BEGIN: Use Case */ |
| 1376 |
|
$content = $this->createContentVersion1(); |
| 1377 |
|
|
| 1378 |
|
// Now we create a new draft from the published content |
| 1379 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1380 |
|
|
| 1381 |
|
// This call will still load the published content version |
| 1382 |
|
$contentPublished = $contentService->loadContentByContentInfo($content->contentInfo); |
| 1383 |
|
/* END: Use Case */ |
| 1384 |
|
|
| 1385 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1386 |
|
} |
| 1387 |
|
|
| 1388 |
|
/** |
| 1389 |
|
* Test for the newContentUpdateStruct() method. |
|
@@ 1707-1724 (lines=18) @@
|
| 1704 |
|
* @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
| 1705 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
| 1706 |
|
*/ |
| 1707 |
|
public function testCreateContentDraftWithSecondParameter() |
| 1708 |
|
{ |
| 1709 |
|
$repository = $this->getRepository(); |
| 1710 |
|
|
| 1711 |
|
$contentService = $repository->getContentService(); |
| 1712 |
|
|
| 1713 |
|
/* BEGIN: Use Case */ |
| 1714 |
|
$contentVersion2 = $this->createContentVersion2(); |
| 1715 |
|
|
| 1716 |
|
// Now we create a new draft from the initial version |
| 1717 |
|
$draftedContentReloaded = $contentService->createContentDraft( |
| 1718 |
|
$contentVersion2->contentInfo, |
| 1719 |
|
$contentVersion2->getVersionInfo() |
| 1720 |
|
); |
| 1721 |
|
/* END: Use Case */ |
| 1722 |
|
|
| 1723 |
|
$this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo); |
| 1724 |
|
} |
| 1725 |
|
|
| 1726 |
|
/** |
| 1727 |
|
* Test for the createContentDraft() method with third parameter. |