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

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