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

@@ 5620-5630 (lines=11) @@
5617
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
5618
     * @expectedExceptionMessage Version is not a draft
5619
     */
5620
    public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion()
5621
    {
5622
        $repository = $this->getRepository();
5623
        $contentService = $repository->getContentService();
5624
5625
        $languageCode = 'eng-US';
5626
        $content = $this->createMultipleLanguageContentVersion2();
5627
        $draft = $contentService->createContentDraft($content->contentInfo);
5628
        $publishedContent = $contentService->publishVersion($draft->versionInfo);
5629
        $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode);
5630
    }
5631
5632
    /**
5633
     * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content.