Code Duplication    Length = 15-17 lines in 2 locations

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

@@ 126-140 (lines=15) @@
123
     *
124
     * @return \eZ\Publish\API\Repository\Values\Content\Content
125
     */
126
    protected function createContentVersion1()
127
    {
128
        $repository = $this->getRepository();
129
130
        $contentService = $repository->getContentService();
131
132
        /* BEGIN: Inline */
133
        $draft = $this->createContentDraftVersion1();
134
135
        // Publish this draft
136
        $content = $contentService->publishVersion($draft->getVersionInfo());
137
        /* END: Inline */
138
139
        return $content;
140
    }
141
142
    /**
143
     * Creates a new content draft named <b>$draftVersion2</b> from a currently

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

@@ 1178-1194 (lines=17) @@
1175
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1176
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
1177
     */
1178
    public function testPublishVersionThrowsBadStateException()
1179
    {
1180
        $repository = $this->getRepository();
1181
1182
        $contentService = $repository->getContentService();
1183
1184
        /* BEGIN: Use Case */
1185
        $draft = $this->createContentDraftVersion1();
1186
1187
        // Publish the content draft
1188
        $contentService->publishVersion($draft->getVersionInfo());
1189
1190
        // This call will fail with a "BadStateException", because the version
1191
        // is already published.
1192
        $contentService->publishVersion($draft->getVersionInfo());
1193
        /* END: Use Case */
1194
    }
1195
1196
    /**
1197
     * Test that publishVersion() does not affect publishedDate (assuming previous version exists).