Code Duplication    Length = 14-17 lines in 3 locations

eZ/Publish/API/Repository/Tests/ContentServiceTest.php 2 locations

@@ 947-963 (lines=17) @@
944
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
945
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
946
     */
947
    public function testPublishVersionThrowsBadStateException()
948
    {
949
        $repository = $this->getRepository();
950
951
        $contentService = $repository->getContentService();
952
953
        /* BEGIN: Use Case */
954
        $draft = $this->createContentDraftVersion1();
955
956
        // Publish the content draft
957
        $contentService->publishVersion($draft->getVersionInfo());
958
959
        // This call will fail with a "BadStateException", because the version
960
        // is already published.
961
        $contentService->publishVersion($draft->getVersionInfo());
962
        /* END: Use Case */
963
    }
964
965
    /**
966
     * Test for the createContentDraft() method.
@@ 2676-2689 (lines=14) @@
2673
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent
2674
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
2675
     */
2676
    public function testDeleteVersionThrowsBadStateExceptionOnLastVersion()
2677
    {
2678
        $repository = $this->getRepository();
2679
2680
        $contentService = $repository->getContentService();
2681
2682
        /* BEGIN: Use Case */
2683
        $draft = $this->createContentDraftVersion1();
2684
2685
        // This call will fail with a "BadStateException", because the Content
2686
        // version is the last version of the Content.
2687
        $contentService->deleteVersion($draft->getVersionInfo());
2688
        /* END: Use Case */
2689
    }
2690
2691
    /**
2692
     * Test for the loadVersions() method.

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

@@ 117-131 (lines=15) @@
114
     *
115
     * @return \eZ\Publish\API\Repository\Values\Content\Content
116
     */
117
    protected function createContentVersion1()
118
    {
119
        $repository = $this->getRepository();
120
121
        $contentService = $repository->getContentService();
122
123
        /* BEGIN: Inline */
124
        $draft = $this->createContentDraftVersion1();
125
126
        // Publish this draft
127
        $content = $contentService->publishVersion($draft->getVersionInfo());
128
        /* END: Inline */
129
130
        return $content;
131
    }
132
133
    /**
134
     * Creates a new content draft named <b>$draftVersion2</b> from a currently