| @@ 5464-5474 (lines=11) @@ | ||
| 5461 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 5462 | * @expectedExceptionMessage Version is not a draft |
|
| 5463 | */ |
|
| 5464 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5465 | { |
|
| 5466 | $repository = $this->getRepository(); |
|
| 5467 | $contentService = $repository->getContentService(); |
|
| 5468 | ||
| 5469 | $languageCode = 'eng-US'; |
|
| 5470 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5471 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5472 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5473 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5474 | } |
|
| 5475 | ||
| 5476 | /** |
|
| 5477 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|
| @@ 734-752 (lines=19) @@ | ||
| 731 | * |
|
| 732 | * @return \eZ\Publish\API\Repository\Values\Content\Content |
|
| 733 | */ |
|
| 734 | public function updateContent($fieldData, $setField = true) |
|
| 735 | { |
|
| 736 | $content = $this->testPublishContent(); |
|
| 737 | ||
| 738 | $repository = $this->getRepository(); |
|
| 739 | $contentService = $repository->getContentService(); |
|
| 740 | ||
| 741 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 742 | ||
| 743 | $updateStruct = $contentService->newContentUpdateStruct(); |
|
| 744 | if ($setField) { |
|
| 745 | $updateStruct->setField( |
|
| 746 | $this->customFieldIdentifier, |
|
| 747 | $fieldData |
|
| 748 | ); |
|
| 749 | } |
|
| 750 | ||
| 751 | return $contentService->updateContent($draft->versionInfo, $updateStruct); |
|
| 752 | } |
|
| 753 | ||
| 754 | /** |
|
| 755 | * @depends testUpdateField |
|