| @@ 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. |
|
| @@ 692-706 (lines=15) @@ | ||
| 689 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 690 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 691 | */ |
|
| 692 | public function testLoadLocationByRemoteIdThrowsNotFoundException() |
|
| 693 | { |
|
| 694 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\NotFoundException::class); |
|
| 695 | ||
| 696 | $repository = $this->getRepository(); |
|
| 697 | ||
| 698 | /* BEGIN: Use Case */ |
|
| 699 | $locationService = $repository->getLocationService(); |
|
| 700 | ||
| 701 | // Throws exception, since Location with remote ID does not exist |
|
| 702 | $location = $locationService->loadLocationByRemoteId( |
|
| 703 | 'not-exists' |
|
| 704 | ); |
|
| 705 | /* END: Use Case */ |
|
| 706 | } |
|
| 707 | ||
| 708 | /** |
|
| 709 | * Test for the loadLocations() method. |
|