| @@ 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 |
|
| @@ 5829-5839 (lines=11) @@ | ||
| 5826 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5827 | * @expectedExceptionMessage Version is not a draft |
|
| 5828 | */ |
|
| 5829 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5830 | { |
|
| 5831 | $repository = $this->getRepository(); |
|
| 5832 | $contentService = $repository->getContentService(); |
|
| 5833 | ||
| 5834 | $languageCode = 'eng-US'; |
|
| 5835 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5836 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5837 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5838 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5839 | } |
|
| 5840 | ||
| 5841 | /** |
|
| 5842 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|