Code Duplication    Length = 11-19 lines in 2 locations

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

@@ 5556-5566 (lines=11) @@
5553
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
5554
     * @expectedExceptionMessage Version is not a draft
5555
     */
5556
    public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion()
5557
    {
5558
        $repository = $this->getRepository();
5559
        $contentService = $repository->getContentService();
5560
5561
        $languageCode = 'eng-US';
5562
        $content = $this->createMultipleLanguageContentVersion2();
5563
        $draft = $contentService->createContentDraft($content->contentInfo);
5564
        $publishedContent = $contentService->publishVersion($draft->versionInfo);
5565
        $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode);
5566
    }
5567
5568
    /**
5569
     * 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