| @@ 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 |
|
| @@ 5876-5886 (lines=11) @@ | ||
| 5873 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5874 | * @expectedExceptionMessage Version is not a draft |
|
| 5875 | */ |
|
| 5876 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5877 | { |
|
| 5878 | $repository = $this->getRepository(); |
|
| 5879 | $contentService = $repository->getContentService(); |
|
| 5880 | ||
| 5881 | $languageCode = 'eng-US'; |
|
| 5882 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5883 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5884 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5885 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5886 | } |
|
| 5887 | ||
| 5888 | /** |
|
| 5889 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|