Code Duplication    Length = 11-19 lines in 2 locations

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

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