@@ 3178-3194 (lines=17) @@ | ||
3175 | * @see \eZ\Publish\API\Repository\ContentTypeService::createContentTypeDraft() |
|
3176 | * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testCreateContentTypeDraft |
|
3177 | */ |
|
3178 | public function testCreateContentTypeDraftThrowsBadStateException() |
|
3179 | { |
|
3180 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\BadStateException::class); |
|
3181 | ||
3182 | $repository = $this->getRepository(); |
|
3183 | ||
3184 | /* BEGIN: Use Case */ |
|
3185 | $contentTypeService = $repository->getContentTypeService(); |
|
3186 | ||
3187 | $commentType = $contentTypeService->loadContentTypeByIdentifier('comment'); |
|
3188 | ||
3189 | $contentTypeService->createContentTypeDraft($commentType); |
|
3190 | ||
3191 | // Throws exception, since type draft already exists |
|
3192 | $contentTypeService->createContentTypeDraft($commentType); |
|
3193 | /* END: Use Case */ |
|
3194 | } |
|
3195 | ||
3196 | /** |
|
3197 | * Test for the deleteContentType() method. |
|
@@ 3226-3241 (lines=16) @@ | ||
3223 | * @see \eZ\Publish\API\Repository\ContentTypeService::deleteContentType() |
|
3224 | * @depends eZ\Publish\API\Repository\Tests\ContentTypeServiceTest::testDeleteContentType |
|
3225 | */ |
|
3226 | public function testDeleteContentTypeThrowsBadStateException() |
|
3227 | { |
|
3228 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\BadStateException::class); |
|
3229 | ||
3230 | $repository = $this->getRepository(); |
|
3231 | ||
3232 | /* BEGIN: Use Case */ |
|
3233 | $contentTypeService = $repository->getContentTypeService(); |
|
3234 | ||
3235 | $contentType = $contentTypeService->loadContentTypeByIdentifier('user'); |
|
3236 | ||
3237 | // This call will fail with a "BadStateException" because there is at |
|
3238 | // least on content object of type "user" in an eZ Publish demo |
|
3239 | $contentTypeService->deleteContentType($contentType); |
|
3240 | /* END: Use Case */ |
|
3241 | } |
|
3242 | ||
3243 | /** |
|
3244 | * Test for the copyContentType() method. |