Code Duplication    Length = 11-19 lines in 2 locations

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

@@ 770-788 (lines=19) @@
767
     *
768
     * @return \eZ\Publish\API\Repository\Values\Content\Content
769
     */
770
    public function updateContent($fieldData, $setField = true)
771
    {
772
        $content = $this->testPublishContent();
773
774
        $repository = $this->getRepository();
775
        $contentService = $repository->getContentService();
776
777
        $draft = $contentService->createContentDraft($content->contentInfo);
778
779
        $updateStruct = $contentService->newContentUpdateStruct();
780
        if ($setField) {
781
            $updateStruct->setField(
782
                $this->customFieldIdentifier,
783
                $fieldData
784
            );
785
        }
786
787
        return $contentService->updateContent($draft->versionInfo, $updateStruct);
788
    }
789
790
    /**
791
     * @depends testUpdateField

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

@@ 5552-5562 (lines=11) @@
5549
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
5550
     * @expectedExceptionMessage Version is not a draft
5551
     */
5552
    public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion()
5553
    {
5554
        $repository = $this->getRepository();
5555
        $contentService = $repository->getContentService();
5556
5557
        $languageCode = 'eng-US';
5558
        $content = $this->createMultipleLanguageContentVersion2();
5559
        $draft = $contentService->createContentDraft($content->contentInfo);
5560
        $publishedContent = $contentService->publishVersion($draft->versionInfo);
5561
        $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode);
5562
    }
5563
5564
    /**
5565
     * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content.