| @@ 3275-3302 (lines=28) @@ | ||
| 3272 | * |
|
| 3273 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 3274 | */ |
|
| 3275 | public function testCreateUrlAliasThrowsInvalidArgumentException() |
|
| 3276 | { |
|
| 3277 | $location = $this->getLocationStub(); |
|
| 3278 | $urlAliasService = $this->getRepository()->getURLAliasService(); |
|
| 3279 | $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler'); |
|
| 3280 | ||
| 3281 | $urlAliasHandler->expects( |
|
| 3282 | $this->once() |
|
| 3283 | )->method( |
|
| 3284 | 'createCustomUrlAlias' |
|
| 3285 | )->with( |
|
| 3286 | $this->equalTo($location->id), |
|
| 3287 | $this->equalTo('path'), |
|
| 3288 | $this->equalTo('forwarding'), |
|
| 3289 | $this->equalTo('languageCode'), |
|
| 3290 | $this->equalTo('alwaysAvailable') |
|
| 3291 | )->will( |
|
| 3292 | $this->throwException(new ForbiddenException('Forbidden!')) |
|
| 3293 | ); |
|
| 3294 | ||
| 3295 | $urlAliasService->createUrlAlias( |
|
| 3296 | $location, |
|
| 3297 | 'path', |
|
| 3298 | 'languageCode', |
|
| 3299 | 'forwarding', |
|
| 3300 | 'alwaysAvailable' |
|
| 3301 | ); |
|
| 3302 | } |
|
| 3303 | ||
| 3304 | /** |
|
| 3305 | * Test for the createGlobalUrlAlias() method. |
|
| @@ 3416-3443 (lines=28) @@ | ||
| 3413 | * |
|
| 3414 | * @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
|
| 3415 | */ |
|
| 3416 | public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionPath() |
|
| 3417 | { |
|
| 3418 | $resource = 'module:content/search'; |
|
| 3419 | $urlAliasService = $this->getRepository()->getURLAliasService(); |
|
| 3420 | $urlAliasHandler = $this->getPersistenceMockHandler('Content\\UrlAlias\\Handler'); |
|
| 3421 | ||
| 3422 | $urlAliasHandler->expects( |
|
| 3423 | $this->once() |
|
| 3424 | )->method( |
|
| 3425 | 'createGlobalUrlAlias' |
|
| 3426 | )->with( |
|
| 3427 | $this->equalTo($resource), |
|
| 3428 | $this->equalTo('path'), |
|
| 3429 | $this->equalTo('forwarding'), |
|
| 3430 | $this->equalTo('languageCode'), |
|
| 3431 | $this->equalTo('alwaysAvailable') |
|
| 3432 | )->will( |
|
| 3433 | $this->throwException(new ForbiddenException('Forbidden!')) |
|
| 3434 | ); |
|
| 3435 | ||
| 3436 | $urlAliasService->createGlobalUrlAlias( |
|
| 3437 | $resource, |
|
| 3438 | 'path', |
|
| 3439 | 'languageCode', |
|
| 3440 | 'forwarding', |
|
| 3441 | 'alwaysAvailable' |
|
| 3442 | ); |
|
| 3443 | } |
|
| 3444 | ||
| 3445 | /** |
|
| 3446 | * Test for the createGlobalUrlAlias() method. |
|