|
@@ 207-229 (lines=23) @@
|
| 204 |
|
/** |
| 205 |
|
* Test for the removeAliases() method. |
| 206 |
|
*/ |
| 207 |
|
public function testRemoveAliases() |
| 208 |
|
{ |
| 209 |
|
$aliasList = array(new UrlAlias(array('isCustom' => true))); |
| 210 |
|
$spiAliasList = array(new SPIUrlAlias(array('isCustom' => true))); |
| 211 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 212 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 213 |
|
/** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */ |
| 214 |
|
$urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler(); |
| 215 |
|
|
| 216 |
|
$repositoryMock |
| 217 |
|
->expects($this->once()) |
| 218 |
|
->method('beginTransaction'); |
| 219 |
|
$repositoryMock |
| 220 |
|
->expects($this->once()) |
| 221 |
|
->method('commit'); |
| 222 |
|
|
| 223 |
|
$urlAliasHandlerMock |
| 224 |
|
->expects($this->once()) |
| 225 |
|
->method('removeURLAliases') |
| 226 |
|
->with($spiAliasList); |
| 227 |
|
|
| 228 |
|
$mockedService->removeAliases($aliasList); |
| 229 |
|
} |
| 230 |
|
|
| 231 |
|
/** |
| 232 |
|
* Test for the removeAliases() method. |
|
@@ 237-260 (lines=24) @@
|
| 234 |
|
* @expectedException Exception |
| 235 |
|
* @expectedExceptionMessage Handler threw an exception |
| 236 |
|
*/ |
| 237 |
|
public function testRemoveAliasesWithRollback() |
| 238 |
|
{ |
| 239 |
|
$aliasList = array(new UrlAlias(array('isCustom' => true))); |
| 240 |
|
$spiAliasList = array(new SPIUrlAlias(array('isCustom' => true))); |
| 241 |
|
$repositoryMock = $this->getRepositoryMock(); |
| 242 |
|
$mockedService = $this->getPartlyMockedURLAliasServiceService(); |
| 243 |
|
/** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */ |
| 244 |
|
$urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler(); |
| 245 |
|
|
| 246 |
|
$repositoryMock |
| 247 |
|
->expects($this->once()) |
| 248 |
|
->method('beginTransaction'); |
| 249 |
|
$repositoryMock |
| 250 |
|
->expects($this->once()) |
| 251 |
|
->method('rollback'); |
| 252 |
|
|
| 253 |
|
$urlAliasHandlerMock |
| 254 |
|
->expects($this->once()) |
| 255 |
|
->method('removeURLAliases') |
| 256 |
|
->with($spiAliasList) |
| 257 |
|
->will($this->throwException(new Exception('Handler threw an exception'))); |
| 258 |
|
|
| 259 |
|
$mockedService->removeAliases($aliasList); |
| 260 |
|
} |
| 261 |
|
|
| 262 |
|
public function providerForTestListAutogeneratedLocationAliasesPath() |
| 263 |
|
{ |