Code Duplication    Length = 19-21 lines in 2 locations

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

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

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

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