| @@ 79-90 (lines=12) @@ | ||
| 76 | * @depends testCreateBookmark |
|
| 77 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 78 | */ |
|
| 79 | public function testCreateBookmarkThrowsInvalidArgumentException() |
|
| 80 | { |
|
| 81 | $repository = $this->getRepository(); |
|
| 82 | ||
| 83 | /* BEGIN: Use Case */ |
|
| 84 | $bookmarkService = $repository->getBookmarkService(); |
|
| 85 | $locationService = $repository->getLocationService(); |
|
| 86 | ||
| 87 | $location = $locationService->loadLocation($this->generateId('location', self::LOCATION_ID_BOOKMARKED)); |
|
| 88 | $bookmarkService->createBookmark($location); |
|
| 89 | /* END: Use Case */ |
|
| 90 | } |
|
| 91 | ||
| 92 | /** |
|
| 93 | * @covers \eZ\Publish\Core\Repository\BookmarkService::deleteBookmark |
|
| @@ 119-130 (lines=12) @@ | ||
| 116 | * @depends testDeleteBookmark |
|
| 117 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 118 | */ |
|
| 119 | public function testDeleteBookmarkThrowsInvalidArgumentException() |
|
| 120 | { |
|
| 121 | $repository = $this->getRepository(); |
|
| 122 | ||
| 123 | /* BEGIN: Use Case */ |
|
| 124 | $bookmarkService = $repository->getBookmarkService(); |
|
| 125 | $locationService = $repository->getLocationService(); |
|
| 126 | ||
| 127 | $location = $locationService->loadLocation($this->generateId('location', self::LOCATION_ID_NOT_BOOKMARKED)); |
|
| 128 | $bookmarkService->deleteBookmark($location); |
|
| 129 | /* END: Use Case */ |
|
| 130 | } |
|
| 131 | ||
| 132 | /** |
|
| 133 | * @covers \eZ\Publish\Core\Repository\BookmarkService::loadBookmarks |
|
| @@ 128-145 (lines=18) @@ | ||
| 125 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 126 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 127 | */ |
|
| 128 | public function testLoadLocationThrowsUnauthorizedException() |
|
| 129 | { |
|
| 130 | $repository = $this->getRepository(); |
|
| 131 | ||
| 132 | $editorsGroupId = $this->generateId('group', 13); |
|
| 133 | ||
| 134 | /* BEGIN: Use Case */ |
|
| 135 | $locationService = $repository->getLocationService(); |
|
| 136 | ||
| 137 | $user = $this->createUserVersion1(); |
|
| 138 | ||
| 139 | // Set current user to newly created user |
|
| 140 | $repository->setCurrentUser($user); |
|
| 141 | ||
| 142 | // This call will fail with an "UnauthorizedException" |
|
| 143 | $locationService->loadLocation($editorsGroupId); |
|
| 144 | /* END: Use Case */ |
|
| 145 | } |
|
| 146 | ||
| 147 | /** |
|
| 148 | * Test for the loadLocationList() method. |
|
| @@ 175-193 (lines=19) @@ | ||
| 172 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 173 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationByRemoteId |
|
| 174 | */ |
|
| 175 | public function testLoadLocationByRemoteIdThrowsUnauthorizedException() |
|
| 176 | { |
|
| 177 | $repository = $this->getRepository(); |
|
| 178 | ||
| 179 | /* BEGIN: Use Case */ |
|
| 180 | // remoteId of the "Editors" location in an eZ Publish demo installation |
|
| 181 | $editorsRemoteId = 'f7dda2854fc68f7c8455d9cb14bd04a9'; |
|
| 182 | ||
| 183 | $locationService = $repository->getLocationService(); |
|
| 184 | ||
| 185 | $user = $this->createUserVersion1(); |
|
| 186 | ||
| 187 | // Set current user to newly created user |
|
| 188 | $repository->setCurrentUser($user); |
|
| 189 | ||
| 190 | // This call will fail with an "UnauthorizedException" |
|
| 191 | $locationService->loadLocationByRemoteId($editorsRemoteId); |
|
| 192 | /* END: Use Case */ |
|
| 193 | } |
|
| 194 | ||
| 195 | /** |
|
| 196 | * Test for the loadLocations() method. |
|
| @@ 767-783 (lines=17) @@ | ||
| 764 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 765 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 766 | */ |
|
| 767 | public function testLoadLocationByRemoteId() |
|
| 768 | { |
|
| 769 | $repository = $this->getRepository(); |
|
| 770 | ||
| 771 | /* BEGIN: Use Case */ |
|
| 772 | $locationService = $repository->getLocationService(); |
|
| 773 | ||
| 774 | $location = $locationService->loadLocationByRemoteId( |
|
| 775 | '3f6d92f8044aed134f32153517850f5a' |
|
| 776 | ); |
|
| 777 | /* END: Use Case */ |
|
| 778 | ||
| 779 | $this->assertEquals( |
|
| 780 | $locationService->loadLocation($this->generateId('location', 5)), |
|
| 781 | $location |
|
| 782 | ); |
|
| 783 | } |
|
| 784 | ||
| 785 | /** |
|
| 786 | * Test for the loadLocationByRemoteId() method. |
|