| @@ 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 |
|
| @@ 1197-1213 (lines=17) @@ | ||
| 1194 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
| 1195 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
|
| 1196 | */ |
|
| 1197 | public function testPublishVersionThrowsBadStateException() |
|
| 1198 | { |
|
| 1199 | $repository = $this->getRepository(); |
|
| 1200 | ||
| 1201 | $contentService = $repository->getContentService(); |
|
| 1202 | ||
| 1203 | /* BEGIN: Use Case */ |
|
| 1204 | $draft = $this->createContentDraftVersion1(); |
|
| 1205 | ||
| 1206 | // Publish the content draft |
|
| 1207 | $contentService->publishVersion($draft->getVersionInfo()); |
|
| 1208 | ||
| 1209 | // This call will fail with a "BadStateException", because the version |
|
| 1210 | // is already published. |
|
| 1211 | $contentService->publishVersion($draft->getVersionInfo()); |
|
| 1212 | /* END: Use Case */ |
|
| 1213 | } |
|
| 1214 | ||
| 1215 | /** |
|
| 1216 | * Test that publishVersion() does not affect publishedDate (assuming previous version exists). |
|