|
@@ 3497-3522 (lines=26) @@
|
| 3494 |
|
* |
| 3495 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 3496 |
|
*/ |
| 3497 |
|
public function testCreateGlobalUrlAliasThrowsInvalidArgumentExceptionResource() |
| 3498 |
|
{ |
| 3499 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 3500 |
|
$permissionResolverMock = $this->createMock(PermissionResolver::class); |
| 3501 |
|
$permissionResolverMock |
| 3502 |
|
->expects($this->once()) |
| 3503 |
|
->method('hasAccess')->with( |
| 3504 |
|
$this->equalTo('content'), |
| 3505 |
|
$this->equalTo('urltranslator') |
| 3506 |
|
)->will($this->returnValue(true)); |
| 3507 |
|
|
| 3508 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 3509 |
|
|
| 3510 |
|
$repositoryMock |
| 3511 |
|
->expects($this->atLeastOnce()) |
| 3512 |
|
->method('getPermissionResolver') |
| 3513 |
|
->willReturn($permissionResolverMock); |
| 3514 |
|
|
| 3515 |
|
$mockedService->createGlobalUrlAlias( |
| 3516 |
|
'invalid/resource', |
| 3517 |
|
'path', |
| 3518 |
|
'languageCode', |
| 3519 |
|
'forwarding', |
| 3520 |
|
'alwaysAvailable' |
| 3521 |
|
); |
| 3522 |
|
} |
| 3523 |
|
|
| 3524 |
|
/** |
| 3525 |
|
* Test for the createGlobalUrlAlias() method. |
|
@@ 3750-3773 (lines=24) @@
|
| 3747 |
|
* @covers \eZ\Publish\Core\Repository\URLAliasService::createGlobalUrlAlias |
| 3748 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 3749 |
|
*/ |
| 3750 |
|
public function testCreateGlobalUrlAliasThrowsUnauthorizedException() |
| 3751 |
|
{ |
| 3752 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 3753 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 3754 |
|
$permissionResolverMock = $this->createMock(PermissionResolver::class); |
| 3755 |
|
$permissionResolverMock |
| 3756 |
|
->expects($this->once()) |
| 3757 |
|
->method('hasAccess')->with( |
| 3758 |
|
$this->equalTo('content'), |
| 3759 |
|
$this->equalTo('urltranslator') |
| 3760 |
|
)->will($this->returnValue(false)); |
| 3761 |
|
|
| 3762 |
|
$repositoryMock |
| 3763 |
|
->expects($this->atLeastOnce()) |
| 3764 |
|
->method('getPermissionResolver') |
| 3765 |
|
->willReturn($permissionResolverMock); |
| 3766 |
|
$mockedService->createGlobalUrlAlias( |
| 3767 |
|
'eznode:42', |
| 3768 |
|
'path', |
| 3769 |
|
'languageCode', |
| 3770 |
|
'forwarding', |
| 3771 |
|
'alwaysAvailable' |
| 3772 |
|
); |
| 3773 |
|
} |
| 3774 |
|
|
| 3775 |
|
/** |
| 3776 |
|
* Test for the removeAliases() method. |