| @@ 130-147 (lines=18) @@ | ||
| 127 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 128 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 129 | */ |
|
| 130 | public function testLoadLocationThrowsUnauthorizedException() |
|
| 131 | { |
|
| 132 | $repository = $this->getRepository(); |
|
| 133 | ||
| 134 | $editorsGroupId = $this->generateId('group', 13); |
|
| 135 | ||
| 136 | /* BEGIN: Use Case */ |
|
| 137 | $locationService = $repository->getLocationService(); |
|
| 138 | ||
| 139 | $user = $this->createUserVersion1(); |
|
| 140 | ||
| 141 | // Set current user to newly created user |
|
| 142 | $repository->setCurrentUser($user); |
|
| 143 | ||
| 144 | // This call will fail with an "UnauthorizedException" |
|
| 145 | $locationService->loadLocation($editorsGroupId); |
|
| 146 | /* END: Use Case */ |
|
| 147 | } |
|
| 148 | ||
| 149 | /** |
|
| 150 | * Test for the loadLocationList() method. |
|
| @@ 177-195 (lines=19) @@ | ||
| 174 | * @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
|
| 175 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocationByRemoteId |
|
| 176 | */ |
|
| 177 | public function testLoadLocationByRemoteIdThrowsUnauthorizedException() |
|
| 178 | { |
|
| 179 | $repository = $this->getRepository(); |
|
| 180 | ||
| 181 | /* BEGIN: Use Case */ |
|
| 182 | // remoteId of the "Editors" location in an eZ Publish demo installation |
|
| 183 | $editorsRemoteId = 'f7dda2854fc68f7c8455d9cb14bd04a9'; |
|
| 184 | ||
| 185 | $locationService = $repository->getLocationService(); |
|
| 186 | ||
| 187 | $user = $this->createUserVersion1(); |
|
| 188 | ||
| 189 | // Set current user to newly created user |
|
| 190 | $repository->setCurrentUser($user); |
|
| 191 | ||
| 192 | // This call will fail with an "UnauthorizedException" |
|
| 193 | $locationService->loadLocationByRemoteId($editorsRemoteId); |
|
| 194 | /* END: Use Case */ |
|
| 195 | } |
|
| 196 | ||
| 197 | /** |
|
| 198 | * Test for the loadLocations() method. |
|
| @@ 622-638 (lines=17) @@ | ||
| 619 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 620 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 621 | */ |
|
| 622 | public function testLoadLocationByRemoteId() |
|
| 623 | { |
|
| 624 | $repository = $this->getRepository(); |
|
| 625 | ||
| 626 | /* BEGIN: Use Case */ |
|
| 627 | $locationService = $repository->getLocationService(); |
|
| 628 | ||
| 629 | $location = $locationService->loadLocationByRemoteId( |
|
| 630 | '3f6d92f8044aed134f32153517850f5a' |
|
| 631 | ); |
|
| 632 | /* END: Use Case */ |
|
| 633 | ||
| 634 | $this->assertEquals( |
|
| 635 | $locationService->loadLocation($this->generateId('location', 5)), |
|
| 636 | $location |
|
| 637 | ); |
|
| 638 | } |
|
| 639 | ||
| 640 | /** |
|
| 641 | * Test for the loadLocationByRemoteId() method. |
|