| @@ 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. |
|