Code Duplication    Length = 11-19 lines in 2 locations

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

@@ 784-802 (lines=19) @@
781
     *
782
     * @return \eZ\Publish\API\Repository\Values\Content\Content
783
     */
784
    public function updateContent($fieldData, $setField = true)
785
    {
786
        $content = $this->testPublishContent();
787
788
        $repository = $this->getRepository();
789
        $contentService = $repository->getContentService();
790
791
        $draft = $contentService->createContentDraft($content->contentInfo);
792
793
        $updateStruct = $contentService->newContentUpdateStruct();
794
        if ($setField) {
795
            $updateStruct->setField(
796
                $this->customFieldIdentifier,
797
                $fieldData
798
            );
799
        }
800
801
        return $contentService->updateContent($draft->versionInfo, $updateStruct);
802
    }
803
804
    /**
805
     * @depends testUpdateField

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

@@ 5868-5878 (lines=11) @@
5865
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
5866
     * @expectedExceptionMessage Version is not a draft
5867
     */
5868
    public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion()
5869
    {
5870
        $repository = $this->getRepository();
5871
        $contentService = $repository->getContentService();
5872
5873
        $languageCode = 'eng-US';
5874
        $content = $this->createMultipleLanguageContentVersion2();
5875
        $draft = $contentService->createContentDraft($content->contentInfo);
5876
        $publishedContent = $contentService->publishVersion($draft->versionInfo);
5877
        $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode);
5878
    }
5879
5880
    /**
5881
     * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content.