Code Duplication    Length = 11-19 lines in 2 locations

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

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

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