Code Duplication    Length = 19-21 lines in 2 locations

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

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

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.