Code Duplication    Length = 19-21 lines in 2 locations

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

@@ 1126-1144 (lines=19) @@
1123
    /**
1124
     * Test creating new translation from existing content with empty field.
1125
     */
1126
    public function testUpdateContentWithNewTranslationOnEmptyField()
1127
    {
1128
        $repository = $this->getRepository();
1129
        $contentService = $repository->getContentService();
1130
1131
        $content = $this->testCreateContentWithEmptyFieldValue();
1132
        $publishedContent = $contentService->publishVersion($content->versionInfo);
1133
1134
        $contentDraft = $contentService->createContentDraft($publishedContent->contentInfo);
1135
        $updateStruct = $contentService->newContentUpdateStruct();
1136
        $updateStruct->setField(
1137
            'data',
1138
            $publishedContent->getFieldValue('data', 'eng-US'),
1139
            'eng-US'
1140
        );
1141
        $updateStruct->initialLanguageCode = 'eng-GB';
1142
        $updatedContentDraft = $contentService->updateContent($contentDraft->versionInfo, $updateStruct);
1143
        $contentService->publishVersion($updatedContentDraft->versionInfo);
1144
    }
1145
1146
    /**
1147
     * 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

@@ 5235-5255 (lines=21) @@
5232
     *
5233
     * @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslation
5234
     */
5235
    public function testDeleteTranslation()
5236
    {
5237
        $repository = $this->getRepository();
5238
        $contentService = $repository->getContentService();
5239
        $content = $this->createContentVersion2();
5240
5241
        // create multiple versions to exceed archive limit
5242
        for ($i = 0; $i < 5; ++$i) {
5243
            $contentDraft = $contentService->createContentDraft($content->contentInfo);
5244
            $contentUpdateStruct = $contentService->newContentUpdateStruct();
5245
            $contentDraft = $contentService->updateContent(
5246
                $contentDraft->versionInfo,
5247
                $contentUpdateStruct
5248
            );
5249
            $contentService->publishVersion($contentDraft->versionInfo);
5250
        }
5251
5252
        $contentService->deleteTranslation($content->contentInfo, 'eng-GB');
5253
5254
        $this->assertTranslationDoesNotExist('eng-GB', $content->id);
5255
    }
5256
5257
    /**
5258
     * Test deleting a Translation which is initial for some Version, updates initialLanguageCode