@@ 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 |
@@ 3023-3036 (lines=14) @@ | ||
3020 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent |
|
3021 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
|
3022 | */ |
|
3023 | public function testDeleteVersionThrowsBadStateExceptionOnLastVersion() |
|
3024 | { |
|
3025 | $repository = $this->getRepository(); |
|
3026 | ||
3027 | $contentService = $repository->getContentService(); |
|
3028 | ||
3029 | /* BEGIN: Use Case */ |
|
3030 | $draft = $this->createContentDraftVersion1(); |
|
3031 | ||
3032 | // This call will fail with a "BadStateException", because the Content |
|
3033 | // version is the last version of the Content. |
|
3034 | $contentService->deleteVersion($draft->getVersionInfo()); |
|
3035 | /* END: Use Case */ |
|
3036 | } |
|
3037 | ||
3038 | /** |
|
3039 | * Test for the loadVersions() method. |
|
@@ 1080-1096 (lines=17) @@ | ||
1077 | * @expectedException \eZ\Publish\API\Repository\Exceptions\BadStateException |
|
1078 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
|
1079 | */ |
|
1080 | public function testPublishVersionThrowsBadStateException() |
|
1081 | { |
|
1082 | $repository = $this->getRepository(); |
|
1083 | ||
1084 | $contentService = $repository->getContentService(); |
|
1085 | ||
1086 | /* BEGIN: Use Case */ |
|
1087 | $draft = $this->createContentDraftVersion1(); |
|
1088 | ||
1089 | // Publish the content draft |
|
1090 | $contentService->publishVersion($draft->getVersionInfo()); |
|
1091 | ||
1092 | // This call will fail with a "BadStateException", because the version |
|
1093 | // is already published. |
|
1094 | $contentService->publishVersion($draft->getVersionInfo()); |
|
1095 | /* END: Use Case */ |
|
1096 | } |
|
1097 | ||
1098 | /** |
|
1099 | * Test that publishVersion() does not affect publishedDate (assuming previous version exists). |