| @@ 784-802 (lines=19) @@ | ||
| 781 | * |
|
| 782 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 783 | */ |
|
| 784 | public function updateContent($fieldData, $setField = true) |
|
| 785 | { |
|
| 786 | $content = $this->testPublishContent(); |
|
| 787 | ||
| 788 | $repository = $this->getRepository(); |
|
| 789 | $contentService = $repository->getContentService(); |
|
| 790 | ||
| 791 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 792 | ||
| 793 | $updateStruct = $contentService->newContentUpdateStruct(); |
|
| 794 | if ($setField) { |
|
| 795 | $updateStruct->setField( |
|
| 796 | $this->customFieldIdentifier, |
|
| 797 | $fieldData |
|
| 798 | ); |
|
| 799 | } |
|
| 800 | ||
| 801 | return $contentService->updateContent($draft->versionInfo, $updateStruct); |
|
| 802 | } |
|
| 803 | ||
| 804 | /** |
|
| 805 | * @depends testUpdateField |
|
| @@ 5733-5743 (lines=11) @@ | ||
| 5730 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5731 | * @expectedExceptionMessage Version is not a draft |
|
| 5732 | */ |
|
| 5733 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5734 | { |
|
| 5735 | $repository = $this->getRepository(); |
|
| 5736 | $contentService = $repository->getContentService(); |
|
| 5737 | ||
| 5738 | $languageCode = 'eng-US'; |
|
| 5739 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5740 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5741 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5742 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5743 | } |
|
| 5744 | ||
| 5745 | /** |
|
| 5746 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|