eZ\Publish\Core\Repository\Tests\Service\Mock\UrlAliasTest::testCreateUrlAliasWithRollback PHP 메소드

testCreateUrlAliasWithRollback() 공개 메소드

Test for the createUrlAlias() method.
    public function testCreateUrlAliasWithRollback()
    {
        $repositoryMock = $this->getRepositoryMock();
        $mockedService = $this->getPartlyMockedURLAliasServiceService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $urlAliasHandlerMock */
        $urlAliasHandlerMock = $this->getPersistenceMock()->urlAliasHandler();
        $location = $this->getLocationStub();
        $repositoryMock->expects($this->once())->method('beginTransaction');
        $repositoryMock->expects($this->once())->method('rollback');
        $urlAliasHandlerMock->expects($this->once())->method('createCustomUrlAlias')->with($this->equalTo($location->id), $this->equalTo('path'), $this->equalTo('forwarding'), $this->equalTo('languageCode'), $this->equalTo('alwaysAvailable'))->will($this->throwException(new Exception('Handler threw an exception')));
        $mockedService->createUrlAlias($location, 'path', 'languageCode', 'forwarding', 'alwaysAvailable');
    }
UrlAliasTest