Code Duplication    Length = 14-17 lines in 3 locations

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

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

@@ 1081-1097 (lines=17) @@
1078
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1079
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
1080
     */
1081
    public function testPublishVersionThrowsBadStateException()
1082
    {
1083
        $repository = $this->getRepository();
1084
1085
        $contentService = $repository->getContentService();
1086
1087
        /* BEGIN: Use Case */
1088
        $draft = $this->createContentDraftVersion1();
1089
1090
        // Publish the content draft
1091
        $contentService->publishVersion($draft->getVersionInfo());
1092
1093
        // This call will fail with a "BadStateException", because the version
1094
        // is already published.
1095
        $contentService->publishVersion($draft->getVersionInfo());
1096
        /* END: Use Case */
1097
    }
1098
1099
    /**
1100
     * Test that publishVersion() does not affect publishedDate (assuming previous version exists).
@@ 3088-3101 (lines=14) @@
3085
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent
3086
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
3087
     */
3088
    public function testDeleteVersionThrowsBadStateExceptionOnLastVersion()
3089
    {
3090
        $repository = $this->getRepository();
3091
3092
        $contentService = $repository->getContentService();
3093
3094
        /* BEGIN: Use Case */
3095
        $draft = $this->createContentDraftVersion1();
3096
3097
        // This call will fail with a "BadStateException", because the Content
3098
        // version is the last version of the Content.
3099
        $contentService->deleteVersion($draft->getVersionInfo());
3100
        /* END: Use Case */
3101
    }
3102
3103
    /**
3104
     * Test for the loadVersions() method.