Code Duplication    Length = 19-21 lines in 2 locations

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

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

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

@@ 1146-1164 (lines=19) @@
1143
    /**
1144
     * Test creating new translation from existing content with empty field.
1145
     */
1146
    public function testUpdateContentWithNewTranslationOnEmptyField()
1147
    {
1148
        $repository = $this->getRepository();
1149
        $contentService = $repository->getContentService();
1150
1151
        $content = $this->testCreateContentWithEmptyFieldValue();
1152
        $publishedContent = $contentService->publishVersion($content->versionInfo);
1153
1154
        $contentDraft = $contentService->createContentDraft($publishedContent->contentInfo);
1155
        $updateStruct = $contentService->newContentUpdateStruct();
1156
        $updateStruct->setField(
1157
            'data',
1158
            $publishedContent->getFieldValue('data', 'eng-US'),
1159
            'eng-US'
1160
        );
1161
        $updateStruct->initialLanguageCode = 'eng-GB';
1162
        $updatedContentDraft = $contentService->updateContent($contentDraft->versionInfo, $updateStruct);
1163
        $contentService->publishVersion($updatedContentDraft->versionInfo);
1164
    }
1165
1166
    /**
1167
     * Get proper multilingual FT-specific Values. It Can be overridden by a Field Type test case.