|
@@ 1437-1453 (lines=17) @@
|
| 1434 |
|
* @see \eZ\Publish\API\Repository\ContentTypeService::updateContentTypeDraft() |
| 1435 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testUpdateContentTypeDraft |
| 1436 |
|
*/ |
| 1437 |
|
public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateIdentifier() |
| 1438 |
|
{ |
| 1439 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 1440 |
|
|
| 1441 |
|
$repository = $this->getRepository(); |
| 1442 |
|
$contentTypeService = $repository->getContentTypeService(); |
| 1443 |
|
|
| 1444 |
|
/* BEGIN: Use Case */ |
| 1445 |
|
$contentTypeDraft = $this->createContentTypeDraft(); |
| 1446 |
|
|
| 1447 |
|
$typeUpdate = $contentTypeService->newContentTypeUpdateStruct(); |
| 1448 |
|
$typeUpdate->identifier = 'folder'; |
| 1449 |
|
|
| 1450 |
|
// Throws exception, since type "folder" already exists |
| 1451 |
|
$contentTypeService->updateContentTypeDraft($contentTypeDraft, $typeUpdate); |
| 1452 |
|
/* END: Use Case */ |
| 1453 |
|
} |
| 1454 |
|
|
| 1455 |
|
/** |
| 1456 |
|
* Test for the updateContentTypeDraft() method. |
|
@@ 1461-1477 (lines=17) @@
|
| 1458 |
|
* @see \eZ\Publish\API\Repository\ContentTypeService::updateContentTypeDraft() |
| 1459 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testUpdateContentTypeDraft |
| 1460 |
|
*/ |
| 1461 |
|
public function testUpdateContentTypeDraftThrowsInvalidArgumentExceptionDuplicateRemoteId() |
| 1462 |
|
{ |
| 1463 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 1464 |
|
|
| 1465 |
|
$repository = $this->getRepository(); |
| 1466 |
|
$contentTypeService = $repository->getContentTypeService(); |
| 1467 |
|
|
| 1468 |
|
/* BEGIN: Use Case */ |
| 1469 |
|
$contentTypeDraft = $this->createContentTypeDraft(); |
| 1470 |
|
|
| 1471 |
|
$typeUpdate = $contentTypeService->newContentTypeUpdateStruct(); |
| 1472 |
|
$typeUpdate->remoteId = 'a3d405b81be900468eb153d774f4f0d2'; |
| 1473 |
|
|
| 1474 |
|
// Throws exception, since remote ID of type "folder" is used |
| 1475 |
|
$contentTypeService->updateContentTypeDraft($contentTypeDraft, $typeUpdate); |
| 1476 |
|
/* END: Use Case */ |
| 1477 |
|
} |
| 1478 |
|
|
| 1479 |
|
/** |
| 1480 |
|
* Test for the updateContentTypeDraft() method. |
|
@@ 1604-1619 (lines=16) @@
|
| 1601 |
|
* @see \eZ\Publish\API\Repository\ContentTypeService::addFieldDefinition() |
| 1602 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testAddFieldDefinition |
| 1603 |
|
*/ |
| 1604 |
|
public function testAddFieldDefinitionThrowsInvalidArgumentExceptionDuplicateFieldIdentifier() |
| 1605 |
|
{ |
| 1606 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 1607 |
|
|
| 1608 |
|
$repository = $this->getRepository(); |
| 1609 |
|
$contentTypeService = $repository->getContentTypeService(); |
| 1610 |
|
|
| 1611 |
|
/* BEGIN: Use Case */ |
| 1612 |
|
$contentTypeDraft = $this->createContentTypeDraft(); |
| 1613 |
|
|
| 1614 |
|
$fieldDefCreate = $contentTypeService->newFieldDefinitionCreateStruct('title', 'ezstring'); |
| 1615 |
|
|
| 1616 |
|
// Throws an exception |
| 1617 |
|
$contentTypeService->addFieldDefinition($contentTypeDraft, $fieldDefCreate); |
| 1618 |
|
/* END: Use Case */ |
| 1619 |
|
} |
| 1620 |
|
|
| 1621 |
|
/** |
| 1622 |
|
* Test for the addFieldDefinition() method. |
|
@@ 1908-1922 (lines=15) @@
|
| 1905 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testRemoveFieldDefinition |
| 1906 |
|
* @covers \eZ\Publish\Core\Repository\ContentTypeService::removeFieldDefinition |
| 1907 |
|
*/ |
| 1908 |
|
public function testRemoveFieldDefinitionThrowsInvalidArgumentExceptionOnWrongDraft() |
| 1909 |
|
{ |
| 1910 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 1911 |
|
|
| 1912 |
|
$repository = $this->getRepository(); |
| 1913 |
|
$contentTypeService = $repository->getContentTypeService(); |
| 1914 |
|
|
| 1915 |
|
$contentTypeDraft01 = $this->createContentTypeDraft(); |
| 1916 |
|
$contentTypeDraft02 = $this->createContentTypeDraft(); |
| 1917 |
|
|
| 1918 |
|
$bodyField = $contentTypeDraft02->getFieldDefinition('body'); |
| 1919 |
|
|
| 1920 |
|
// Throws an exception because $bodyField field belongs to another draft |
| 1921 |
|
$contentTypeService->removeFieldDefinition($contentTypeDraft01, $bodyField); |
| 1922 |
|
} |
| 1923 |
|
|
| 1924 |
|
/** |
| 1925 |
|
* Test for the removeFieldDefinition() method. |