| @@ 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 |
|
| @@ 5676-5686 (lines=11) @@ | ||
| 5673 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5674 | * @expectedExceptionMessage Version is not a draft |
|
| 5675 | */ |
|
| 5676 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5677 | { |
|
| 5678 | $repository = $this->getRepository(); |
|
| 5679 | $contentService = $repository->getContentService(); |
|
| 5680 | ||
| 5681 | $languageCode = 'eng-US'; |
|
| 5682 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5683 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5684 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5685 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5686 | } |
|
| 5687 | ||
| 5688 | /** |
|
| 5689 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|