| @@ 3185-3205 (lines=21) @@ | ||
| 3182 | /** |
|
| 3183 | * Test for the createGlobalUrlAlias() method. |
|
| 3184 | */ |
|
| 3185 | public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionResource() |
|
| 3186 | { |
|
| 3187 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\InvalidArgumentException::class); |
|
| 3188 | ||
| 3189 | $mockedService = $this->getPartlyMockedURLAliasServiceService(); |
|
| 3190 | $this->permissionResolver |
|
| 3191 | ->expects($this->once()) |
|
| 3192 | ->method('hasAccess')->with( |
|
| 3193 | $this->equalTo('content'), |
|
| 3194 | $this->equalTo('urltranslator') |
|
| 3195 | ) |
|
| 3196 | ->will($this->returnValue(true)); |
|
| 3197 | ||
| 3198 | $mockedService->createGlobalUrlAlias( |
|
| 3199 | 'invalid/resource', |
|
| 3200 | 'path', |
|
| 3201 | 'languageCode', |
|
| 3202 | 'forwarding', |
|
| 3203 | 'alwaysAvailable' |
|
| 3204 | ); |
|
| 3205 | } |
|
| 3206 | ||
| 3207 | /** |
|
| 3208 | * Test for the createGlobalUrlAlias() method. |
|
| @@ 3418-3438 (lines=21) @@ | ||
| 3415 | * |
|
| 3416 | * @covers \eZ\Publish\Core\Repository\URLAliasService::createGlobalUrlAlias |
|
| 3417 | */ |
|
| 3418 | public function testCreateGlobalUrlAliasThrowsUnauthorizedException() |
|
| 3419 | { |
|
| 3420 | $this->expectException(\eZ\Publish\API\Repository\Exceptions\UnauthorizedException::class); |
|
| 3421 | ||
| 3422 | $mockedService = $this->getPartlyMockedURLAliasServiceService(); |
|
| 3423 | $this->permissionResolver |
|
| 3424 | ->expects($this->once()) |
|
| 3425 | ->method('hasAccess')->with( |
|
| 3426 | $this->equalTo('content'), |
|
| 3427 | $this->equalTo('urltranslator') |
|
| 3428 | ) |
|
| 3429 | ->will($this->returnValue(false)); |
|
| 3430 | ||
| 3431 | $mockedService->createGlobalUrlAlias( |
|
| 3432 | 'eznode:42', |
|
| 3433 | 'path', |
|
| 3434 | 'languageCode', |
|
| 3435 | 'forwarding', |
|
| 3436 | 'alwaysAvailable' |
|
| 3437 | ); |
|
| 3438 | } |
|
| 3439 | ||
| 3440 | /** |
|
| 3441 | * Test for the removeAliases() method. |
|