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

@@ 1139-1155 (lines=17) @@
1136
     * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException
1137
     * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion
1138
     */
1139
    public function testPublishVersionThrowsBadStateException()
1140
    {
1141
        $repository = $this->getRepository();
1142
1143
        $contentService = $repository->getContentService();
1144
1145
        /* BEGIN: Use Case */
1146
        $draft = $this->createContentDraftVersion1();
1147
1148
        // Publish the content draft
1149
        $contentService->publishVersion($draft->getVersionInfo());
1150
1151
        // This call will fail with a "BadStateException", because the version
1152
        // is already published.
1153
        $contentService->publishVersion($draft->getVersionInfo());
1154
        /* END: Use Case */
1155
    }
1156
1157
    /**
1158
     * Test that publishVersion() does not affect publishedDate (assuming previous version exists).