| @@ 726-742 (lines=17) @@ | ||
| 723 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 724 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 725 | */ |
|
| 726 | public function testLoadLocationByRemoteId() |
|
| 727 | { |
|
| 728 | $repository = $this->getRepository(); |
|
| 729 | ||
| 730 | /* BEGIN: Use Case */ |
|
| 731 | $locationService = $repository->getLocationService(); |
|
| 732 | ||
| 733 | $location = $locationService->loadLocationByRemoteId( |
|
| 734 | '3f6d92f8044aed134f32153517850f5a' |
|
| 735 | ); |
|
| 736 | /* END: Use Case */ |
|
| 737 | ||
| 738 | $this->assertEquals( |
|
| 739 | $locationService->loadLocation($this->generateId('location', 5)), |
|
| 740 | $location |
|
| 741 | ); |
|
| 742 | } |
|
| 743 | ||
| 744 | /** |
|
| 745 | * Test for the loadLocationByRemoteId() method. |
|
| @@ 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. |
|