| @@ 778-795 (lines=18) @@ | ||
| 775 | * @throws \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 776 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 777 | */ |
|
| 778 | public function testInternalLinkValidatorIgnoresMissingRelationOnNotUpdatedField() |
|
| 779 | { |
|
| 780 | $repository = $this->getRepository(); |
|
| 781 | $contentService = $repository->getContentService(); |
|
| 782 | ||
| 783 | list(, $contentB) = $this->prepareInternalLinkValidatorBrokenLinksTestCase($repository); |
|
| 784 | ||
| 785 | // update field w/o erroneous link to trigger validation |
|
| 786 | $contentUpdateStruct = $contentService->newContentUpdateStruct(); |
|
| 787 | $contentUpdateStruct->setField('data', $this->getValidUpdateFieldData(), 'eng-US'); |
|
| 788 | ||
| 789 | $contentDraftB = $contentService->updateContent( |
|
| 790 | $contentService->createContentDraft($contentB->contentInfo)->versionInfo, |
|
| 791 | $contentUpdateStruct |
|
| 792 | ); |
|
| 793 | ||
| 794 | $contentService->publishVersion($contentDraftB->versionInfo); |
|
| 795 | } |
|
| 796 | ||
| 797 | /** |
|
| 798 | * Test updating Content which contains links to deleted Location fails when updating broken field. |
|
| @@ 2011-2035 (lines=25) @@ | ||
| 2008 | * @see \eZ\Publish\API\Repository\ContentService::publishVersion() |
|
| 2009 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersionFromContentDraft |
|
| 2010 | */ |
|
| 2011 | public function testPublishVersionFromOldContentDraftArchivesNewerVersionNo() |
|
| 2012 | { |
|
| 2013 | $repository = $this->getRepository(); |
|
| 2014 | ||
| 2015 | $contentService = $repository->getContentService(); |
|
| 2016 | ||
| 2017 | /* BEGIN: Use Case */ |
|
| 2018 | $content = $this->createContentVersion1(); |
|
| 2019 | ||
| 2020 | // Create a new draft with versionNo = 2 |
|
| 2021 | $draftedContentVersion2 = $contentService->createContentDraft($content->contentInfo); |
|
| 2022 | ||
| 2023 | // Create another new draft with versionNo = 3 |
|
| 2024 | $draftedContentVersion3 = $contentService->createContentDraft($content->contentInfo); |
|
| 2025 | ||
| 2026 | // Publish draft with versionNo = 3 |
|
| 2027 | $contentService->publishVersion($draftedContentVersion3->getVersionInfo()); |
|
| 2028 | ||
| 2029 | // Publish the first draft with versionNo = 2 |
|
| 2030 | // currentVersionNo is now 2, versionNo 3 will be archived |
|
| 2031 | $publishedDraft = $contentService->publishVersion($draftedContentVersion2->getVersionInfo()); |
|
| 2032 | /* END: Use Case */ |
|
| 2033 | ||
| 2034 | $this->assertEquals(2, $publishedDraft->contentInfo->currentVersionNo); |
|
| 2035 | } |
|
| 2036 | ||
| 2037 | /** |
|
| 2038 | * Test for the publishVersion() method, and that it creates limited archives. |
|
| @@ 5865-5878 (lines=14) @@ | ||
| 5862 | * |
|
| 5863 | * @covers \eZ\Publish\Core\Repository\ContentService::deleteTranslationFromDraft |
|
| 5864 | */ |
|
| 5865 | public function testDeleteTranslationFromDraftThrowsBadStateExceptionOnPublishedVersion() |
|
| 5866 | { |
|
| 5867 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\BadStateException::class); |
|
| 5868 | $this->expectExceptionMessage('Version is not a draft'); |
|
| 5869 | ||
| 5870 | $repository = $this->getRepository(); |
|
| 5871 | $contentService = $repository->getContentService(); |
|
| 5872 | ||
| 5873 | $languageCode = 'eng-US'; |
|
| 5874 | $content = $this->createMultipleLanguageContentVersion2(); |
|
| 5875 | $draft = $contentService->createContentDraft($content->contentInfo); |
|
| 5876 | $publishedContent = $contentService->publishVersion($draft->versionInfo); |
|
| 5877 | $contentService->deleteTranslationFromDraft($publishedContent->versionInfo, $languageCode); |
|
| 5878 | } |
|
| 5879 | ||
| 5880 | /** |
|
| 5881 | * Test deleting a Translation from Draft throws UnauthorizedException if user cannot edit Content. |
|