eZ\Publish\Core\Repository\Tests\Service\Integration\UrlWildcardTest::testCreateWithRollback PHP Method

testCreateWithRollback() public method

Test for the create() method.
    public function testCreateWithRollback()
    {
        $mockedService = $this->getPartlyMockedURLWildcardService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $handlerMock */
        $handlerMock = $this->getPersistenceMock()->urlWildcardHandler();
        $repositoryMock = $this->getRepositoryMock();
        $repositoryMock->expects($this->once())->method('hasAccess')->with($this->equalTo('content'), $this->equalTo('urltranslator'))->will($this->returnValue(true));
        $repositoryMock->expects($this->once())->method('beginTransaction');
        $repositoryMock->expects($this->once())->method('rollback');
        $handlerMock->expects($this->once())->method('loadAll')->will($this->returnValue(array()));
        $sourceUrl = '/lorem';
        $destinationUrl = '/ipsum';
        $forward = true;
        $handlerMock->expects($this->once())->method('create')->with($this->equalTo($sourceUrl), $this->equalTo($destinationUrl), $this->equalTo($forward))->will($this->throwException(new \Exception()));
        $mockedService->create($sourceUrl, $destinationUrl, $forward);
    }