Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
Complex classes like ContentServiceAuthorizationTest often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use ContentServiceAuthorizationTest, and based on these observations, apply Extract Interface, too.
| 1 | <?php |
||
| 24 | class ContentServiceAuthorizationTest extends BaseContentServiceTest |
||
| 25 | { |
||
| 26 | /** @var \eZ\Publish\API\Repository\Values\User\User */ |
||
| 27 | private $administratorUser; |
||
| 28 | |||
| 29 | /** @var \eZ\Publish\API\Repository\Values\User\User */ |
||
| 30 | private $anonymousUser; |
||
| 31 | |||
| 32 | /** @var \eZ\Publish\API\Repository\Repository */ |
||
| 33 | private $repository; |
||
|
|
|||
| 34 | |||
| 35 | /** @var \eZ\Publish\API\Repository\PermissionResolver */ |
||
| 36 | private $permissionResolver; |
||
| 37 | |||
| 38 | /** @var \eZ\Publish\API\Repository\UserService */ |
||
| 39 | private $userService; |
||
| 40 | |||
| 41 | /** @var \eZ\Publish\API\Repository\ContentService */ |
||
| 42 | private $contentService; |
||
| 43 | |||
| 44 | public function setUp(): void |
||
| 59 | |||
| 60 | /** |
||
| 61 | * Test for the createContent() method. |
||
| 62 | * |
||
| 63 | * @see \eZ\Publish\API\Repository\ContentService::createContent() |
||
| 64 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent |
||
| 65 | */ |
||
| 66 | View Code Duplication | public function testCreateContentThrowsUnauthorizedException() |
|
| 85 | |||
| 86 | /** |
||
| 87 | * Test for the createContent() method. |
||
| 88 | * |
||
| 89 | * @see \eZ\Publish\API\Repository\ContentService::createContent($contentCreateStruct, $locationCreateStructs) |
||
| 90 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContent |
||
| 91 | */ |
||
| 92 | public function testCreateContentThrowsUnauthorizedExceptionWithSecondParameter() |
||
| 101 | |||
| 102 | /** |
||
| 103 | * Test for the loadContentInfo() method. |
||
| 104 | * |
||
| 105 | * @see \eZ\Publish\API\Repository\ContentService::loadContentInfo() |
||
| 106 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfo |
||
| 107 | */ |
||
| 108 | View Code Duplication | public function testLoadContentInfoThrowsUnauthorizedException() |
|
| 119 | |||
| 120 | /** |
||
| 121 | * Test for the sudo() method. |
||
| 122 | * |
||
| 123 | * @see \eZ\Publish\API\Repository\Repository::sudo() |
||
| 124 | * @depends testLoadContentInfoThrowsUnauthorizedException |
||
| 125 | */ |
||
| 126 | public function testSudo() |
||
| 141 | |||
| 142 | /** |
||
| 143 | * Test for the loadContentInfoList() method. |
||
| 144 | * |
||
| 145 | * @see \eZ\Publish\API\Repository\ContentService::loadContentInfoList() |
||
| 146 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfoList |
||
| 147 | */ |
||
| 148 | public function testLoadContentInfoListSkipsUnauthorizedItems() |
||
| 155 | |||
| 156 | /** |
||
| 157 | * Test for the loadContentInfoByRemoteId() method. |
||
| 158 | * |
||
| 159 | * @see \eZ\Publish\API\Repository\ContentService::loadContentInfoByRemoteId() |
||
| 160 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentInfoByRemoteId |
||
| 161 | */ |
||
| 162 | View Code Duplication | public function testLoadContentInfoByRemoteIdThrowsUnauthorizedException() |
|
| 173 | |||
| 174 | /** |
||
| 175 | * Test for the loadVersionInfo() method. |
||
| 176 | * |
||
| 177 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfo() |
||
| 178 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfo |
||
| 179 | */ |
||
| 180 | public function testLoadVersionInfoThrowsUnauthorizedException() |
||
| 191 | |||
| 192 | /** |
||
| 193 | * Test for the loadVersionInfo() method. |
||
| 194 | * |
||
| 195 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfo($contentInfo, $versionNo) |
||
| 196 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoWithSecondParameter |
||
| 197 | */ |
||
| 198 | public function testLoadVersionInfoThrowsUnauthorizedExceptionWithSecondParameter() |
||
| 209 | |||
| 210 | /** |
||
| 211 | * Test for the loadVersionInfoById() method. |
||
| 212 | * |
||
| 213 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById() |
||
| 214 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoById |
||
| 215 | */ |
||
| 216 | View Code Duplication | public function testLoadVersionInfoByIdThrowsUnauthorizedException() |
|
| 226 | |||
| 227 | /** |
||
| 228 | * Test for the loadVersionInfoById() method. |
||
| 229 | * |
||
| 230 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
||
| 231 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoByIdWithSecondParameter |
||
| 232 | */ |
||
| 233 | View Code Duplication | public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionWithSecondParameter() |
|
| 243 | |||
| 244 | /** |
||
| 245 | * Test for the loadVersionInfoById() method. |
||
| 246 | * |
||
| 247 | * @see \eZ\Publish\API\Repository\ContentService::loadVersionInfoById($contentId, $versionNo) |
||
| 248 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersionInfoById |
||
| 249 | */ |
||
| 250 | public function testLoadVersionInfoByIdThrowsUnauthorizedExceptionForFirstDraft() |
||
| 265 | |||
| 266 | /** |
||
| 267 | * Test for the loadContentByContentInfo() method. |
||
| 268 | * |
||
| 269 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo() |
||
| 270 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfo |
||
| 271 | */ |
||
| 272 | public function testLoadContentByContentInfoThrowsUnauthorizedException() |
||
| 283 | |||
| 284 | /** |
||
| 285 | * Test for the loadContentByContentInfo() method. |
||
| 286 | * |
||
| 287 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages) |
||
| 288 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithLanguageParameters |
||
| 289 | */ |
||
| 290 | View Code Duplication | public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithSecondParameter() |
|
| 301 | |||
| 302 | /** |
||
| 303 | * Test for the loadContentByContentInfo() method. |
||
| 304 | * |
||
| 305 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByContentInfo($contentInfo, $languages, $versionNo) |
||
| 306 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByContentInfoWithVersionNumberParameter |
||
| 307 | */ |
||
| 308 | View Code Duplication | public function testLoadContentByContentInfoThrowsUnauthorizedExceptionWithThirdParameter() |
|
| 319 | |||
| 320 | /** |
||
| 321 | * Test for the loadContentByVersionInfo() method. |
||
| 322 | * |
||
| 323 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo() |
||
| 324 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfo |
||
| 325 | */ |
||
| 326 | View Code Duplication | public function testLoadContentByVersionInfoThrowsUnauthorizedException() |
|
| 339 | |||
| 340 | /** |
||
| 341 | * Test for the loadContentByVersionInfo() method. |
||
| 342 | * |
||
| 343 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByVersionInfo($versionInfo, $languages) |
||
| 344 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByVersionInfoWithSecondParameter |
||
| 345 | */ |
||
| 346 | View Code Duplication | public function testLoadContentByVersionInfoThrowsUnauthorizedExceptionWithSecondParameter() |
|
| 359 | |||
| 360 | /** |
||
| 361 | * Test for the loadContent() method. |
||
| 362 | * |
||
| 363 | * @see \eZ\Publish\API\Repository\ContentService::loadContent() |
||
| 364 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
||
| 365 | */ |
||
| 366 | View Code Duplication | public function testLoadContentThrowsUnauthorizedException() |
|
| 376 | |||
| 377 | /** |
||
| 378 | * Test for the loadContent() method. |
||
| 379 | * |
||
| 380 | * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages) |
||
| 381 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithPrioritizedLanguages |
||
| 382 | */ |
||
| 383 | View Code Duplication | public function testLoadContentThrowsUnauthorizedExceptionWithSecondParameter() |
|
| 393 | |||
| 394 | /** |
||
| 395 | * Test for the loadContent() method. |
||
| 396 | * |
||
| 397 | * @see \eZ\Publish\API\Repository\ContentService::loadContent($contentId, $languages, $versionNo) |
||
| 398 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentWithThirdParameter |
||
| 399 | */ |
||
| 400 | View Code Duplication | public function testLoadContentThrowsUnauthorizedExceptionWithThirdParameter() |
|
| 410 | |||
| 411 | /** |
||
| 412 | * Test for the loadContent() method on a draft. |
||
| 413 | * |
||
| 414 | * @see \eZ\Publish\API\Repository\ContentService::loadContent() |
||
| 415 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
||
| 416 | */ |
||
| 417 | public function testLoadContentThrowsUnauthorizedExceptionOnDrafts() |
||
| 435 | |||
| 436 | /** |
||
| 437 | * Test for the ContentService::loadContent() method on an archive. |
||
| 438 | * |
||
| 439 | * This test the version permission on loading archived versions |
||
| 440 | * |
||
| 441 | * @see \eZ\Publish\API\Repository\ContentService::loadContent() |
||
| 442 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContent |
||
| 443 | */ |
||
| 444 | public function testLoadContentThrowsUnauthorizedExceptionsOnArchives() |
||
| 481 | |||
| 482 | /** |
||
| 483 | * Test for the loadContentByRemoteId() method. |
||
| 484 | * |
||
| 485 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId() |
||
| 486 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteId |
||
| 487 | */ |
||
| 488 | View Code Duplication | public function testLoadContentByRemoteIdThrowsUnauthorizedException() |
|
| 499 | |||
| 500 | /** |
||
| 501 | * Test for the loadContentByRemoteId() method. |
||
| 502 | * |
||
| 503 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages) |
||
| 504 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithSecondParameter |
||
| 505 | */ |
||
| 506 | View Code Duplication | public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithSecondParameter() |
|
| 517 | |||
| 518 | /** |
||
| 519 | * Test for the loadContentByRemoteId() method. |
||
| 520 | * |
||
| 521 | * @see \eZ\Publish\API\Repository\ContentService::loadContentByRemoteId($remoteId, $languages, $versionNo) |
||
| 522 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentByRemoteIdWithThirdParameter |
||
| 523 | */ |
||
| 524 | View Code Duplication | public function testLoadContentByRemoteIdThrowsUnauthorizedExceptionWithThirdParameter() |
|
| 535 | |||
| 536 | /** |
||
| 537 | * Test for the updateContentMetadata() method. |
||
| 538 | * |
||
| 539 | * @see \eZ\Publish\API\Repository\ContentService::updateContentMetadata() |
||
| 540 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContentMetadata |
||
| 541 | */ |
||
| 542 | public function testUpdateContentMetadataThrowsUnauthorizedException() |
||
| 566 | |||
| 567 | /** |
||
| 568 | * Test for the deleteContent() method. |
||
| 569 | * |
||
| 570 | * @see \eZ\Publish\API\Repository\ContentService::deleteContent() |
||
| 571 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testDeleteContent |
||
| 572 | */ |
||
| 573 | public function testDeleteContentThrowsUnauthorizedException() |
||
| 574 | { |
||
| 575 | $contentVersion2 = $this->createContentVersion2(); |
||
| 576 | |||
| 577 | $contentInfo = $contentVersion2->contentInfo; |
||
| 578 | |||
| 579 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 580 | |||
| 581 | $this->expectException(UnauthorizedException::class); |
||
| 582 | $this->expectExceptionMessageRegExp('/\'remove\' \'content\'/'); |
||
| 583 | |||
| 584 | $this->contentService->deleteContent($contentInfo); |
||
| 585 | } |
||
| 586 | |||
| 587 | /** |
||
| 588 | * Test for the createContentDraft() method. |
||
| 589 | * |
||
| 590 | * @see \eZ\Publish\API\Repository\ContentService::createContentDraft() |
||
| 591 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraft |
||
| 592 | */ |
||
| 593 | public function testCreateContentDraftThrowsUnauthorizedException() |
||
| 594 | { |
||
| 595 | $content = $this->createContentVersion1(); |
||
| 596 | |||
| 597 | $contentInfo = $content->contentInfo; |
||
| 598 | |||
| 599 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 600 | |||
| 601 | $this->expectException(UnauthorizedException::class); |
||
| 602 | $this->expectExceptionMessageRegExp('/\'edit\' \'content\'/'); |
||
| 603 | |||
| 604 | $this->contentService->createContentDraft($contentInfo); |
||
| 605 | } |
||
| 606 | |||
| 607 | /** |
||
| 608 | * Test for the createContentDraft() method. |
||
| 609 | * |
||
| 610 | * @see \eZ\Publish\API\Repository\ContentService::createContentDraft($contentInfo, $versionInfo) |
||
| 611 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCreateContentDraftWithSecondParameter |
||
| 612 | */ |
||
| 613 | public function testCreateContentDraftThrowsUnauthorizedExceptionWithSecondParameter() |
||
| 627 | |||
| 628 | /** |
||
| 629 | * Test for the countContentDrafts() method. |
||
| 630 | * |
||
| 631 | * @see \eZ\Publish\API\Repository\ContentService::countContentDrafts() |
||
| 632 | */ |
||
| 633 | public function testCountContentDraftsReturnZero() |
||
| 639 | |||
| 640 | /** |
||
| 641 | * Test for the loadContentDrafts() method. |
||
| 642 | * |
||
| 643 | * @see \eZ\Publish\API\Repository\ContentService::loadContentDrafts() |
||
| 644 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentDrafts |
||
| 645 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentDrafts |
||
| 646 | */ |
||
| 647 | public function testLoadContentDraftsThrowsUnauthorizedException() |
||
| 656 | |||
| 657 | /** |
||
| 658 | * Test for the loadContentDrafts() method. |
||
| 659 | * |
||
| 660 | * @see \eZ\Publish\API\Repository\ContentService::loadContentDrafts($user) |
||
| 661 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadContentDrafts |
||
| 662 | */ |
||
| 663 | public function testLoadContentDraftsThrowsUnauthorizedExceptionWithUser() |
||
| 672 | |||
| 673 | /** |
||
| 674 | * Test for the updateContent() method. |
||
| 675 | * |
||
| 676 | * @see \eZ\Publish\API\Repository\ContentService::updateContent() |
||
| 677 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testUpdateContent |
||
| 678 | */ |
||
| 679 | View Code Duplication | public function testUpdateContentThrowsUnauthorizedException() |
|
| 700 | |||
| 701 | /** |
||
| 702 | * Test for the publishVersion() method. |
||
| 703 | * |
||
| 704 | * @see \eZ\Publish\API\Repository\ContentService::publishVersion() |
||
| 705 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testPublishVersion |
||
| 706 | */ |
||
| 707 | public function testPublishVersionThrowsUnauthorizedException() |
||
| 708 | { |
||
| 709 | $draft = $this->createContentDraftVersion1(); |
||
| 710 | |||
| 711 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 712 | |||
| 713 | $this->expectException(UnauthorizedException::class); |
||
| 714 | $this->expectExceptionMessageRegExp('/\'publish\' \'content\'/'); |
||
| 715 | |||
| 716 | $this->contentService->publishVersion($draft->getVersionInfo()); |
||
| 717 | } |
||
| 718 | |||
| 719 | /** |
||
| 720 | * Test for the deleteVersion() method. |
||
| 721 | * |
||
| 722 | * @see \eZ\Publish\API\Repository\ContentService::deleteVersion() |
||
| 723 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testDeleteVersion |
||
| 724 | */ |
||
| 725 | public function testDeleteVersionThrowsUnauthorizedException() |
||
| 726 | { |
||
| 727 | $draft = $this->createContentDraftVersion1(); |
||
| 728 | |||
| 729 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 730 | |||
| 731 | $this->expectException(UnauthorizedException::class); |
||
| 732 | $this->expectExceptionMessageRegExp('/\'versionremove\' \'content\'/'); |
||
| 733 | |||
| 734 | $this->contentService->deleteVersion($draft->getVersionInfo()); |
||
| 735 | } |
||
| 736 | |||
| 737 | /** |
||
| 738 | * Test for the loadVersions() method. |
||
| 739 | * |
||
| 740 | * @see \eZ\Publish\API\Repository\ContentService::loadVersions() |
||
| 741 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadVersions |
||
| 742 | */ |
||
| 743 | public function testLoadVersionsThrowsUnauthorizedException() |
||
| 744 | { |
||
| 745 | $contentVersion2 = $this->createContentVersion2(); |
||
| 746 | |||
| 747 | $contentInfo = $contentVersion2->contentInfo; |
||
| 748 | |||
| 749 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 750 | |||
| 751 | $this->expectException(UnauthorizedException::class); |
||
| 752 | $this->expectExceptionMessageRegExp('/\'versionread\' \'content\'/'); |
||
| 753 | |||
| 754 | $this->contentService->loadVersions($contentInfo); |
||
| 755 | } |
||
| 756 | |||
| 757 | /** |
||
| 758 | * Test for the copyContent() method. |
||
| 759 | * |
||
| 760 | * @see \eZ\Publish\API\Repository\ContentService::copyContent() |
||
| 761 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCopyContent |
||
| 762 | */ |
||
| 763 | public function testCopyContentThrowsUnauthorizedException() |
||
| 792 | |||
| 793 | /** |
||
| 794 | * Test for the copyContent() method. |
||
| 795 | * |
||
| 796 | * @see \eZ\Publish\API\Repository\ContentService::copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo) |
||
| 797 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testCopyContentWithGivenVersion |
||
| 798 | */ |
||
| 799 | public function testCopyContentThrowsUnauthorizedExceptionWithGivenVersion() |
||
| 825 | |||
| 826 | /** |
||
| 827 | * Test for the loadRelations() method. |
||
| 828 | * |
||
| 829 | * @see \eZ\Publish\API\Repository\ContentService::loadRelations() |
||
| 830 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations |
||
| 831 | */ |
||
| 832 | View Code Duplication | public function testLoadRelationsThrowsUnauthorizedException() |
|
| 851 | |||
| 852 | /** |
||
| 853 | * Test for the loadRelations() method. |
||
| 854 | * |
||
| 855 | * @see \eZ\Publish\API\Repository\ContentService::loadRelations() |
||
| 856 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadRelations |
||
| 857 | */ |
||
| 858 | public function testLoadRelationsForDraftVersionThrowsUnauthorizedException() |
||
| 859 | { |
||
| 860 | $draft = $this->createContentDraftVersion1(); |
||
| 861 | |||
| 862 | $this->permissionResolver->setCurrentUserReference($this->anonymousUser); |
||
| 863 | |||
| 864 | $this->expectException(UnauthorizedException::class); |
||
| 865 | $this->expectExceptionMessageRegExp('/\'versionread\' \'content\'/'); |
||
| 866 | |||
| 867 | $this->contentService->loadRelations($draft->versionInfo); |
||
| 868 | } |
||
| 869 | |||
| 870 | /** |
||
| 871 | * Test for the loadReverseRelations() method. |
||
| 872 | * |
||
| 873 | * @see \eZ\Publish\API\Repository\ContentService::loadReverseRelations() |
||
| 874 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testLoadReverseRelations |
||
| 875 | */ |
||
| 876 | public function testLoadReverseRelationsThrowsUnauthorizedException() |
||
| 891 | |||
| 892 | /** |
||
| 893 | * Test for the addRelation() method. |
||
| 894 | * |
||
| 895 | * @see \eZ\Publish\API\Repository\ContentService::addRelation() |
||
| 896 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testAddRelation |
||
| 897 | */ |
||
| 898 | View Code Duplication | public function testAddRelationThrowsUnauthorizedException() |
|
| 918 | |||
| 919 | /** |
||
| 920 | * Test for the deleteRelation() method. |
||
| 921 | * |
||
| 922 | * @see \eZ\Publish\API\Repository\ContentService::deleteRelation() |
||
| 923 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testDeleteRelation |
||
| 924 | */ |
||
| 925 | public function testDeleteRelationThrowsUnauthorizedException() |
||
| 948 | |||
| 949 | /** |
||
| 950 | * Creates a pseudo editor with a limitation to objects in the "Media/Images" |
||
| 951 | * subtree. |
||
| 952 | * |
||
| 953 | * @return \eZ\Publish\API\Repository\Values\User\User |
||
| 954 | */ |
||
| 955 | private function createAnonymousWithEditorRole() |
||
| 975 | |||
| 976 | /** |
||
| 977 | * Test that for an user that doesn't have access (read permissions) to an |
||
| 978 | * related object, executing loadRelations() would not throw any exception, |
||
| 979 | * only that the non-readable related object(s) won't be loaded. |
||
| 980 | * |
||
| 981 | * @see \eZ\Publish\API\Repository\ContentService::loadRelations() |
||
| 982 | * @depends eZ\Publish\API\Repository\Tests\ContentServiceTest::testAddRelation |
||
| 983 | */ |
||
| 984 | public function testLoadRelationsWithUnauthorizedRelations() |
||
| 1133 | |||
| 1134 | /** |
||
| 1135 | * Test copying Content to the authorized Location (limited by policies). |
||
| 1136 | */ |
||
| 1137 | public function testCopyContentToAuthorizedLocation() |
||
| 1177 | |||
| 1178 | /** |
||
| 1179 | * Test copying Content to the authorized Location (limited by policies). |
||
| 1180 | */ |
||
| 1181 | public function testCopyContentToAuthorizedLocationWithSubtreeLimitation() |
||
| 1232 | |||
| 1233 | /** |
||
| 1234 | * @return \eZ\Publish\API\Repository\Values\Content\ContentInfo |
||
| 1235 | * |
||
| 1236 | * @throws \eZ\Publish\API\Repository\Exceptions\NotFoundException |
||
| 1237 | * @throws \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
||
| 1238 | */ |
||
| 1239 | private function getContentInfoForAnonymousUser(): ContentInfo |
||
| 1245 | |||
| 1246 | private function setRestrictedEditorUser(): void |
||
| 1250 | } |
||
| 1251 |