Code Duplication    Length = 19-21 lines in 2 locations

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

@@ 1143-1161 (lines=19) @@
1140
    /**
1141
     * Test creating new translation from existing content with empty field.
1142
     */
1143
    public function testUpdateContentWithNewTranslationOnEmptyField()
1144
    {
1145
        $repository = $this->getRepository();
1146
        $contentService = $repository->getContentService();
1147
1148
        $content = $this->testCreateContentWithEmptyFieldValue();
1149
        $publishedContent = $contentService->publishVersion($content->versionInfo);
1150
1151
        $contentDraft = $contentService->createContentDraft($publishedContent->contentInfo);
1152
        $updateStruct = $contentService->newContentUpdateStruct();
1153
        $updateStruct->setField(
1154
            'data',
1155
            $publishedContent->getFieldValue('data', 'eng-US'),
1156
            'eng-US'
1157
        );
1158
        $updateStruct->initialLanguageCode = 'eng-GB';
1159
        $updatedContentDraft = $contentService->updateContent($contentDraft->versionInfo, $updateStruct);
1160
        $contentService->publishVersion($updatedContentDraft->versionInfo);
1161
    }
1162
1163
    /**
1164
     * 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

@@ 5386-5406 (lines=21) @@
5383
     *
5384
     * @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslation
5385
     */
5386
    public function testDeleteTranslation()
5387
    {
5388
        $repository = $this->getRepository();
5389
        $contentService = $repository->getContentService();
5390
        $content = $this->createContentVersion2();
5391
5392
        // create multiple versions to exceed archive limit
5393
        for ($i = 0; $i < 5; ++$i) {
5394
            $contentDraft = $contentService->createContentDraft($content->contentInfo);
5395
            $contentUpdateStruct = $contentService->newContentUpdateStruct();
5396
            $contentDraft = $contentService->updateContent(
5397
                $contentDraft->versionInfo,
5398
                $contentUpdateStruct
5399
            );
5400
            $contentService->publishVersion($contentDraft->versionInfo);
5401
        }
5402
5403
        $contentService->deleteTranslation($content->contentInfo, 'eng-GB');
5404
5405
        $this->assertTranslationDoesNotExist('eng-GB', $content->id);
5406
    }
5407
5408
    /**
5409
     * Test deleting a Translation which is initial for some Version, updates initialLanguageCode