| @@ 94-112 (lines=19) @@ | ||
| 91 | * @see \eZ\Publish\API\Repository\TrashService::trash() |
|
| 92 | * @depends eZ\Publish\API\Repository\Tests\TrashServiceTest::testTrash |
|
| 93 | */ |
|
| 94 | public function testTrashRemovesLocationFromMainStorage() |
|
| 95 | { |
|
| 96 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class); |
|
| 97 | ||
| 98 | $repository = $this->getRepository(); |
|
| 99 | ||
| 100 | $mediaRemoteId = '75c715a51699d2d309a924eca6a95145'; |
|
| 101 | ||
| 102 | /* BEGIN: Use Case */ |
|
| 103 | $this->createTrashItem(); |
|
| 104 | ||
| 105 | // Load the location service |
|
| 106 | $locationService = $repository->getLocationService(); |
|
| 107 | ||
| 108 | // This call will fail with a "NotFoundException", because the media |
|
| 109 | // location was marked as trashed in the main storage |
|
| 110 | $locationService->loadLocationByRemoteId($mediaRemoteId); |
|
| 111 | /* END: Use Case */ |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Test for the trash() method. |
|
| @@ 717-731 (lines=15) @@ | ||
| 714 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 715 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 716 | */ |
|
| 717 | public function testLoadLocationByRemoteIdThrowsNotFoundException() |
|
| 718 | { |
|
| 719 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class); |
|
| 720 | ||
| 721 | $repository = $this->getRepository(); |
|
| 722 | ||
| 723 | /* BEGIN: Use Case */ |
|
| 724 | $locationService = $repository->getLocationService(); |
|
| 725 | ||
| 726 | // Throws exception, since Location with remote ID does not exist |
|
| 727 | $location = $locationService->loadLocationByRemoteId( |
|
| 728 | 'not-exists' |
|
| 729 | ); |
|
| 730 | /* END: Use Case */ |
|
| 731 | } |
|
| 732 | ||
| 733 | /** |
|
| 734 | * Test for the loadLocations() method. |
|