| @@ 799-817 (lines=19) @@ | ||
| 796 | * |
|
| 797 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 798 | */ |
|
| 799 | public function updateContent($fieldData, $setField = true) |
|
| 800 | { |
|
| 801 | $content = $this->testPublishContent(); |
|
| 802 | ||
| 803 | $repository = $this->getRepository(); |
|
| 804 | $contentService = $repository->getContentService(); |
|
| 805 | ||
| 806 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 807 | ||
| 808 | $updateStruct = $contentService->newContentUpdateStruct(); |
|
| 809 | if ($setField) { |
|
| 810 | $updateStruct->setField( |
|
| 811 | $this->customFieldIdentifier, |
|
| 812 | $fieldData |
|
| 813 | ); |
|
| 814 | } |
|
| 815 | ||
| 816 | return $contentService->updateContent($draft->versionInfo, $updateStruct); |
|
| 817 | } |
|
| 818 | ||
| 819 | /** |
|
| 820 | * @depends testUpdateField |
|
| @@ 5830-5840 (lines=11) @@ | ||
| 5827 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5828 | * @expectedExceptionMessage Version is not a draft |
|
| 5829 | */ |
|
| 5830 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5831 | { |
|
| 5832 | $repository = $this->getRepository(); |
|
| 5833 | $contentService = $repository->getContentService(); |
|
| 5834 | ||
| 5835 | $languageCode = 'eng-US'; |
|
| 5836 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5837 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5838 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5839 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5840 | } |
|
| 5841 | ||
| 5842 | /** |
|
| 5843 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|