|
@@ 2238-2263 (lines=26) @@
|
| 2235 |
|
* @covers \eZ\Publish\API\Repository\ContentService::updateContentMetadata() |
| 2236 |
|
* @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContentMetadata |
| 2237 |
|
*/ |
| 2238 |
|
public function testUpdateContentMetadataThrowsInvalidArgumentExceptionOnDuplicateRemoteId() |
| 2239 |
|
{ |
| 2240 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 2241 |
|
|
| 2242 |
|
$repository = $this->getRepository(); |
| 2243 |
|
|
| 2244 |
|
$contentService = $repository->getContentService(); |
| 2245 |
|
|
| 2246 |
|
/* BEGIN: Use Case */ |
| 2247 |
|
// RemoteId of the "Media" page of an eZ Publish demo installation |
| 2248 |
|
$mediaRemoteId = 'a6e35cbcb7cd6ae4b691f3eee30cd262'; |
| 2249 |
|
|
| 2250 |
|
$content = $this->createContentVersion1(); |
| 2251 |
|
|
| 2252 |
|
// Creates a metadata update struct |
| 2253 |
|
$metadataUpdate = $contentService->newContentMetadataUpdateStruct(); |
| 2254 |
|
$metadataUpdate->remoteId = $mediaRemoteId; |
| 2255 |
|
|
| 2256 |
|
// This call will fail with an "InvalidArgumentException", because the |
| 2257 |
|
// specified remoteId is already used by the "Media" page. |
| 2258 |
|
$contentService->updateContentMetadata( |
| 2259 |
|
$content->contentInfo, |
| 2260 |
|
$metadataUpdate |
| 2261 |
|
); |
| 2262 |
|
/* END: Use Case */ |
| 2263 |
|
} |
| 2264 |
|
|
| 2265 |
|
/** |
| 2266 |
|
* Test for the updateContentMetadata() method. |
|
@@ 5920-5932 (lines=13) @@
|
| 5917 |
|
* |
| 5918 |
|
* @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslationFromDraft |
| 5919 |
|
*/ |
| 5920 |
|
public function testDeleteTranslationFromDraftThrowsInvalidArgumentException() |
| 5921 |
|
{ |
| 5922 |
|
$this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
| 5923 |
|
$this->expectExceptionMessageRegExp('/The Version \\(ContentId=\\d+, VersionNo=\\d+\\) is not translated into ger-DE/'); |
| 5924 |
|
|
| 5925 |
|
$repository = $this->getRepository(); |
| 5926 |
|
$contentService = $repository->getContentService(); |
| 5927 |
|
|
| 5928 |
|
$languageCode = 'ger-DE'; |
| 5929 |
|
$content = $this->createMultipleLanguageContentVersion2(); |
| 5930 |
|
$draft = $contentService->createContentDraft($content->contentInfo); |
| 5931 |
|
$contentService->deleteTranslationFromDraft($draft->versionInfo, $languageCode); |
| 5932 |
|
} |
| 5933 |
|
|
| 5934 |
|
/** |
| 5935 |
|
* Test loading list of Content items. |