| @@ 5164-5184 (lines=21) @@ | ||
| 5161 | * |
|
| 5162 | * @covers \eZ\Publish\Core\Repository\ContentService::removeTranslation |
|
| 5163 | */ |
|
| 5164 | public function testRemoveTranslation() |
|
| 5165 | { |
|
| 5166 | $repository = $this->getRepository(); |
|
| 5167 | $contentService = $repository->getContentService(); |
|
| 5168 | $content = $this->createContentVersion2(); |
|
| 5169 | ||
| 5170 | // create multiple versions to exceed archive limit |
|
| 5171 | for ($i = 0; $i < 5; ++$i) { |
|
| 5172 | $contentDraft = $contentService->createContentDraft($content->contentInfo); |
|
| 5173 | $contentUpdateStruct = $contentService->newContentUpdateStruct(); |
|
| 5174 | $contentDraft = $contentService->updateContent( |
|
| 5175 | $contentDraft->versionInfo, |
|
| 5176 | $contentUpdateStruct |
|
| 5177 | ); |
|
| 5178 | $contentService->publishVersion($contentDraft->versionInfo); |
|
| 5179 | } |
|
| 5180 | ||
| 5181 | $contentService->removeTranslation($content->contentInfo, 'eng-GB'); |
|
| 5182 | ||
| 5183 | $this->assertTranslationDoesNotExist('eng-GB', $content->id); |
|
| 5184 | } |
|
| 5185 | ||
| 5186 | /** |
|
| 5187 | * Test removing a translation which is initial for some Version, updates initialLanguageCode |
|
| @@ 1076-1094 (lines=19) @@ | ||
| 1073 | /** |
|
| 1074 | * Test creating new translation from existing content with empty field. |
|
| 1075 | */ |
|
| 1076 | public function testUpdateContentWithNewTranslationOnEmptyField() |
|
| 1077 | { |
|
| 1078 | $repository = $this->getRepository(); |
|
| 1079 | $contentService = $repository->getContentService(); |
|
| 1080 | ||
| 1081 | $content = $this->testCreateContentWithEmptyFieldValue(); |
|
| 1082 | $publishedContent = $contentService->publishVersion($content->versionInfo); |
|
| 1083 | ||
| 1084 | $contentDraft = $contentService->createContentDraft($publishedContent->contentInfo); |
|
| 1085 | $updateStruct = $contentService->newContentUpdateStruct(); |
|
| 1086 | $updateStruct->setField( |
|
| 1087 | 'data', |
|
| 1088 | $publishedContent->getFieldValue('data', 'eng-US'), |
|
| 1089 | 'eng-US' |
|
| 1090 | ); |
|
| 1091 | $updateStruct->initialLanguageCode = 'eng-GB'; |
|
| 1092 | $updatedContentDraft = $contentService->updateContent($contentDraft->versionInfo, $updateStruct); |
|
| 1093 | $contentService->publishVersion($updatedContentDraft->versionInfo); |
|
| 1094 | } |
|
| 1095 | } |
|
| 1096 | ||