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

@@ 5424-5444 (lines=21) @@
5421
     *
5422
     * @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslation
5423
     */
5424
    public function testDeleteTranslation()
5425
    {
5426
        $repository = $this->getRepository();
5427
        $contentService = $repository->getContentService();
5428
        $content = $this->createContentVersion2();
5429
5430
        // create multiple versions to exceed archive limit
5431
        for ($i = 0; $i < 5; ++$i) {
5432
            $contentDraft = $contentService->createContentDraft($content->contentInfo);
5433
            $contentUpdateStruct = $contentService->newContentUpdateStruct();
5434
            $contentDraft = $contentService->updateContent(
5435
                $contentDraft->versionInfo,
5436
                $contentUpdateStruct
5437
            );
5438
            $contentService->publishVersion($contentDraft->versionInfo);
5439
        }
5440
5441
        $contentService->deleteTranslation($content->contentInfo, 'eng-GB');
5442
5443
        $this->assertTranslationDoesNotExist('eng-GB', $content->id);
5444
    }
5445
5446
    /**
5447
     * Test deleting a Translation which is initial for some Version, updates initialLanguageCode