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

testCreateUrlAlias() public method

Test for the createUrlAlias() method.
public testCreateUrlAlias ( )
    public function testCreateUrlAlias()
    {
        $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('commit');
        $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->returnValue(new SPIUrlAlias()));
        $urlAlias = $mockedService->createUrlAlias($location, 'path', 'languageCode', 'forwarding', 'alwaysAvailable');
        self::assertInstanceOf('eZ\\Publish\\API\\Repository\\Values\\Content\\URLAlias', $urlAlias);
    }
UrlAliasTest