| @@ 1112-1130 (lines=19) @@ | ||
| 1109 | /** |
|
| 1110 | * Test creating new translation from existing content with empty field. |
|
| 1111 | */ |
|
| 1112 | public function testUpdateContentWithNewTranslationOnEmptyField() |
|
| 1113 | { |
|
| 1114 | $repository = $this->getRepository(); |
|
| 1115 | $contentService = $repository->getContentService(); |
|
| 1116 | ||
| 1117 | $content = $this->testCreateContentWithEmptyFieldValue(); |
|
| 1118 | $publishedContent = $contentService->publishVersion($content->versionInfo); |
|
| 1119 | ||
| 1120 | $contentDraft = $contentService->createContentDraft($publishedContent->contentInfo); |
|
| 1121 | $updateStruct = $contentService->newContentUpdateStruct(); |
|
| 1122 | $updateStruct->setField( |
|
| 1123 | 'data', |
|
| 1124 | $publishedContent->getFieldValue('data', 'eng-US'), |
|
| 1125 | 'eng-US' |
|
| 1126 | ); |
|
| 1127 | $updateStruct->initialLanguageCode = 'eng-GB'; |
|
| 1128 | $updatedContentDraft = $contentService->updateContent($contentDraft->versionInfo, $updateStruct); |
|
| 1129 | $contentService->publishVersion($updatedContentDraft->versionInfo); |
|
| 1130 | } |
|
| 1131 | ||
| 1132 | /** |
|
| 1133 | * Get proper multilingual FT-specific Values. It Can be overridden by a Field Type test case. |
|
| @@ 5176-5196 (lines=21) @@ | ||
| 5173 | * |
|
| 5174 | * @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslation |
|
| 5175 | */ |
|
| 5176 | public function testDeleteTranslation() |
|
| 5177 | { |
|
| 5178 | $repository = $this->getRepository(); |
|
| 5179 | $contentService = $repository->getContentService(); |
|
| 5180 | $content = $this->createContentVersion2(); |
|
| 5181 | ||
| 5182 | // create multiple versions to exceed archive limit |
|
| 5183 | for ($i = 0; $i < 5; ++$i) { |
|
| 5184 | $contentDraft = $contentService->createContentDraft($content->contentInfo); |
|
| 5185 | $contentUpdateStruct = $contentService->newContentUpdateStruct(); |
|
| 5186 | $contentDraft = $contentService->updateContent( |
|
| 5187 | $contentDraft->versionInfo, |
|
| 5188 | $contentUpdateStruct |
|
| 5189 | ); |
|
| 5190 | $contentService->publishVersion($contentDraft->versionInfo); |
|
| 5191 | } |
|
| 5192 | ||
| 5193 | $contentService->deleteTranslation($content->contentInfo, 'eng-GB'); |
|
| 5194 | ||
| 5195 | $this->assertTranslationDoesNotExist('eng-GB', $content->id); |
|
| 5196 | } |
|
| 5197 | ||
| 5198 | /** |
|
| 5199 | * Test deleting a Translation which is initial for some Version, updates initialLanguageCode |
|