|
@@ 1276-1293 (lines=18) @@
|
| 1273 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1274 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo |
| 1275 |
|
*/ |
| 1276 |
|
public function testCreateContentDraftLoadVersionInfoStillLoadsPublishedVersion($draft) |
| 1277 |
|
{ |
| 1278 |
|
$repository = $this->getRepository(); |
| 1279 |
|
|
| 1280 |
|
$contentService = $repository->getContentService(); |
| 1281 |
|
|
| 1282 |
|
/* BEGIN: Use Case */ |
| 1283 |
|
$content = $this->createContentVersion1(); |
| 1284 |
|
|
| 1285 |
|
// Now we create a new draft from the published content |
| 1286 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1287 |
|
|
| 1288 |
|
// This call will still load the published version |
| 1289 |
|
$versionInfoPublished = $contentService->loadVersionInfo($content->contentInfo); |
| 1290 |
|
/* END: Use Case */ |
| 1291 |
|
|
| 1292 |
|
$this->assertEquals(1, $versionInfoPublished->versionNo); |
| 1293 |
|
} |
| 1294 |
|
|
| 1295 |
|
/** |
| 1296 |
|
* Test for the createContentDraft() method. |
|
@@ 1302-1319 (lines=18) @@
|
| 1299 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
| 1300 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1301 |
|
*/ |
| 1302 |
|
public function testCreateContentDraftLoadContentStillLoadsPublishedVersion() |
| 1303 |
|
{ |
| 1304 |
|
$repository = $this->getRepository(); |
| 1305 |
|
|
| 1306 |
|
$contentService = $repository->getContentService(); |
| 1307 |
|
|
| 1308 |
|
/* BEGIN: Use Case */ |
| 1309 |
|
$content = $this->createContentVersion1(); |
| 1310 |
|
|
| 1311 |
|
// Now we create a new draft from the published content |
| 1312 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1313 |
|
|
| 1314 |
|
// This call will still load the published content version |
| 1315 |
|
$contentPublished = $contentService->loadContent($content->id); |
| 1316 |
|
/* END: Use Case */ |
| 1317 |
|
|
| 1318 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1319 |
|
} |
| 1320 |
|
|
| 1321 |
|
/** |
| 1322 |
|
* Test for the createContentDraft() method. |
|
@@ 1328-1345 (lines=18) @@
|
| 1325 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId |
| 1326 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1327 |
|
*/ |
| 1328 |
|
public function testCreateContentDraftLoadContentByRemoteIdStillLoadsPublishedVersion() |
| 1329 |
|
{ |
| 1330 |
|
$repository = $this->getRepository(); |
| 1331 |
|
|
| 1332 |
|
$contentService = $repository->getContentService(); |
| 1333 |
|
|
| 1334 |
|
/* BEGIN: Use Case */ |
| 1335 |
|
$content = $this->createContentVersion1(); |
| 1336 |
|
|
| 1337 |
|
// Now we create a new draft from the published content |
| 1338 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1339 |
|
|
| 1340 |
|
// This call will still load the published content version |
| 1341 |
|
$contentPublished = $contentService->loadContentByRemoteId('abcdef0123456789abcdef0123456789'); |
| 1342 |
|
/* END: Use Case */ |
| 1343 |
|
|
| 1344 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1345 |
|
} |
| 1346 |
|
|
| 1347 |
|
/** |
| 1348 |
|
* Test for the createContentDraft() method. |
|
@@ 1354-1371 (lines=18) @@
|
| 1351 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo |
| 1352 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
| 1353 |
|
*/ |
| 1354 |
|
public function testCreateContentDraftLoadContentByContentInfoStillLoadsPublishedVersion() |
| 1355 |
|
{ |
| 1356 |
|
$repository = $this->getRepository(); |
| 1357 |
|
|
| 1358 |
|
$contentService = $repository->getContentService(); |
| 1359 |
|
|
| 1360 |
|
/* BEGIN: Use Case */ |
| 1361 |
|
$content = $this->createContentVersion1(); |
| 1362 |
|
|
| 1363 |
|
// Now we create a new draft from the published content |
| 1364 |
|
$contentService->createContentDraft($content->contentInfo); |
| 1365 |
|
|
| 1366 |
|
// This call will still load the published content version |
| 1367 |
|
$contentPublished = $contentService->loadContentByContentInfo($content->contentInfo); |
| 1368 |
|
/* END: Use Case */ |
| 1369 |
|
|
| 1370 |
|
$this->assertEquals(1, $contentPublished->getVersionInfo()->versionNo); |
| 1371 |
|
} |
| 1372 |
|
|
| 1373 |
|
/** |
| 1374 |
|
* Test for the newContentUpdateStruct() method. |
|
@@ 1692-1709 (lines=18) @@
|
| 1689 |
|
* @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
| 1690 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
| 1691 |
|
*/ |
| 1692 |
|
public function testCreateContentDraftWithSecondParameter() |
| 1693 |
|
{ |
| 1694 |
|
$repository = $this->getRepository(); |
| 1695 |
|
|
| 1696 |
|
$contentService = $repository->getContentService(); |
| 1697 |
|
|
| 1698 |
|
/* BEGIN: Use Case */ |
| 1699 |
|
$contentVersion2 = $this->createContentVersion2(); |
| 1700 |
|
|
| 1701 |
|
// Now we create a new draft from the initial version |
| 1702 |
|
$draftedContentReloaded = $contentService->createContentDraft( |
| 1703 |
|
$contentVersion2->contentInfo, |
| 1704 |
|
$contentVersion2->getVersionInfo() |
| 1705 |
|
); |
| 1706 |
|
/* END: Use Case */ |
| 1707 |
|
|
| 1708 |
|
$this->assertEquals(3, $draftedContentReloaded->getVersionInfo()->versionNo); |
| 1709 |
|
} |
| 1710 |
|
|
| 1711 |
|
/** |
| 1712 |
|
* Test for the createContentDraft() method with third parameter. |