| @@ 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. |
|
| @@ 38-58 (lines=21) @@ | ||
| 35 | * |
|
| 36 | * @see \eZ\Publish\API\Repository\LocationService::newLocationCreateStruct() |
|
| 37 | */ |
|
| 38 | public function testNewLocationCreateStruct() |
|
| 39 | { |
|
| 40 | $repository = $this->getRepository(); |
|
| 41 | ||
| 42 | $parentLocationId = $this->generateId('location', 1); |
|
| 43 | /* BEGIN: Use Case */ |
|
| 44 | // $parentLocationId is the ID of an existing location |
|
| 45 | $locationService = $repository->getLocationService(); |
|
| 46 | ||
| 47 | $locationCreate = $locationService->newLocationCreateStruct( |
|
| 48 | $parentLocationId |
|
| 49 | ); |
|
| 50 | /* END: Use Case */ |
|
| 51 | ||
| 52 | $this->assertInstanceOf( |
|
| 53 | '\\eZ\\Publish\\API\\Repository\\Values\\Content\\LocationCreateStruct', |
|
| 54 | $locationCreate |
|
| 55 | ); |
|
| 56 | ||
| 57 | return $locationCreate; |
|
| 58 | } |
|
| 59 | ||
| 60 | /** |
|
| 61 | * Test for the newLocationCreateStruct() method. |
|
| @@ 687-703 (lines=17) @@ | ||
| 684 | * @see \eZ\Publish\API\Repository\LocationService::loadLocationByRemoteId() |
|
| 685 | * @depends eZ\Publish\API\Repository\Tests\LocationServiceTest::testLoadLocation |
|
| 686 | */ |
|
| 687 | public function testLoadLocationByRemoteId() |
|
| 688 | { |
|
| 689 | $repository = $this->getRepository(); |
|
| 690 | ||
| 691 | /* BEGIN: Use Case */ |
|
| 692 | $locationService = $repository->getLocationService(); |
|
| 693 | ||
| 694 | $location = $locationService->loadLocationByRemoteId( |
|
| 695 | '3f6d92f8044aed134f32153517850f5a' |
|
| 696 | ); |
|
| 697 | /* END: Use Case */ |
|
| 698 | ||
| 699 | $this->assertEquals( |
|
| 700 | $locationService->loadLocation($this->generateId('location', 5)), |
|
| 701 | $location |
|
| 702 | ); |
|
| 703 | } |
|
| 704 | ||
| 705 | /** |
|
| 706 | * Test for the loadLocationByRemoteId() method. |
|