Code Duplication    Length = 15-17 lines in 2 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 1 location

@@ 1082-1098 (lines=17) @@
1079
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1080
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
1081
     */
1082
    public function testPublishVersionThrowsBadStateException()
1083
    {
1084
        $repository = $this->getRepository();
1085
1086
        $contentService = $repository->getContentService();
1087
1088
        /* BEGIN: Use Case */
1089
        $draft = $this->createContentDraftVersion1();
1090
1091
        // Publish the content draft
1092
        $contentService->publishVersion($draft->getVersionInfo());
1093
1094
        // This call will fail with a "BadStateException", because the version
1095
        // is already published.
1096
        $contentService->publishVersion($draft->getVersionInfo());
1097
        /* END: Use Case */
1098
    }
1099
1100
    /**
1101
     * Test that publishVersion() does not affect publishedDate (assuming previous version exists).