Code Duplication    Length = 19-21 lines in 2 locations

eZ/Publish/API/Repository/Tests/FieldType/BaseIntegrationTest.php 1 location

@@ 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

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 1 location

@@ 5169-5189 (lines=21) @@
5166
     *
5167
     * @covers \eZ\Publish\Core\Repository\ContentService::removeTranslation
5168
     */
5169
    public function testRemoveTranslation()
5170
    {
5171
        $repository = $this->getRepository();
5172
        $contentService = $repository->getContentService();
5173
        $content = $this->createContentVersion2();
5174
5175
        // create multiple versions to exceed archive limit
5176
        for ($i = 0; $i < 5; ++$i) {
5177
            $contentDraft = $contentService->createContentDraft($content->contentInfo);
5178
            $contentUpdateStruct = $contentService->newContentUpdateStruct();
5179
            $contentDraft = $contentService->updateContent(
5180
                $contentDraft->versionInfo,
5181
                $contentUpdateStruct
5182
            );
5183
            $contentService->publishVersion($contentDraft->versionInfo);
5184
        }
5185
5186
        $contentService->removeTranslation($content->contentInfo, 'eng-GB');
5187
5188
        $this->assertTranslationDoesNotExist('eng-GB', $content->id);
5189
    }
5190
5191
    /**
5192
     * Test removing a translation which is initial for some Version, updates initialLanguageCode