|
@@ 189-209 (lines=21) @@
|
| 186 |
|
* |
| 187 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\InvalidArgumentException |
| 188 |
|
*/ |
| 189 |
|
public function testRemoveAliasesThrowsInvalidArgumentException() |
| 190 |
|
{ |
| 191 |
|
$aliasList = array(new UrlAlias(array('isCustom' => false))); |
| 192 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 193 |
|
$permissionResolverMock = $this->createMock(PermissionResolver::class); |
| 194 |
|
$permissionResolverMock |
| 195 |
|
->expects($this->once()) |
| 196 |
|
->method('hasAccess')->with( |
| 197 |
|
$this->equalTo('content'), |
| 198 |
|
$this->equalTo('urltranslator') |
| 199 |
|
)->will($this->returnValue(true)); |
| 200 |
|
|
| 201 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 202 |
|
|
| 203 |
|
$repositoryMock |
| 204 |
|
->expects($this->atLeastOnce()) |
| 205 |
|
->method('getPermissionResolver') |
| 206 |
|
->willReturn($permissionResolverMock); |
| 207 |
|
|
| 208 |
|
$mockedService->removeAliases($aliasList); |
| 209 |
|
} |
| 210 |
|
|
| 211 |
|
/** |
| 212 |
|
* Test for the removeAliases() method. |
|
@@ 3782-3800 (lines=19) @@
|
| 3779 |
|
* @covers \eZ\Publish\Core\Repository\URLAliasService::removeAliases |
| 3780 |
|
* @expectedException \eZ\Publish\API\Repository\Exceptions\UnauthorizedException |
| 3781 |
|
*/ |
| 3782 |
|
public function testRemoveAliasesThrowsUnauthorizedException() |
| 3783 |
|
{ |
| 3784 |
|
$aliasList = array(new UrlAlias(array('isCustom' => true))); |
| 3785 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 3786 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 3787 |
|
$permissionResolverMock = $this->createMock(PermissionResolver::class); |
| 3788 |
|
$permissionResolverMock |
| 3789 |
|
->expects($this->once()) |
| 3790 |
|
->method('hasAccess')->with( |
| 3791 |
|
$this->equalTo('content'), |
| 3792 |
|
$this->equalTo('urltranslator') |
| 3793 |
|
)->will($this->returnValue(false)); |
| 3794 |
|
|
| 3795 |
|
$repositoryMock |
| 3796 |
|
->expects($this->atLeastOnce()) |
| 3797 |
|
->method('getPermissionResolver') |
| 3798 |
|
->willReturn($permissionResolverMock); |
| 3799 |
|
$mockedService->removeAliases($aliasList); |
| 3800 |
|
} |
| 3801 |
|
} |
| 3802 |
|
|