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

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