eZ\Publish\Core\Repository\Tests\Service\Mock\UrlAliasTest::testRemoveAliasesWithRollback PHP Method

testRemoveAliasesWithRollback() public method

Test for the removeAliases() method.
    public function testRemoveAliasesWithRollback()
    {
        $aliasList = array(new UrlAlias(array('isCustom' => true)));
        $spiAliasList = array(new SPIUrlAlias(array('isCustom' => true)));
        $repositoryMock = $this->getRepositoryMock();
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
        $repositoryMock->expects($this->once())->method('beginTransaction');
        $repositoryMock->expects($this->once())->method('rollback');
        $urlAliasHandlerMock->expects($this->once())->method('removeURLAliases')->with($spiAliasList)->will($this->throwException(new Exception('Handler threw an exception')));
        $mockedService->removeAliases($aliasList);
    }
UrlAliasTest