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

testTranslateUsesLongestMatchingWildcard() public method

Test for the translate() method.
    public function testTranslateUsesLongestMatchingWildcard()
    {
        $mockedService = $this->getPartlyMockedURLWildcardService();
        /** @var \PHPUnit_Framework_MockObject_MockObject $handlerMock */
        $handlerMock = $this->getPersistenceMock()->urlWildcardHandler();
        $handlerMock->expects($this->once())->method('loadAll')->with($this->equalTo(0), $this->equalTo(-1))->will($this->returnValue(array(new SPIURLWildcard(array('sourceUrl' => '/something/*', 'destinationUrl' => '/short', 'forward' => true)), new SPIURLWildcard(array('sourceUrl' => '/something/something/*', 'destinationUrl' => '/long', 'forward' => false)))));
        $translationResult = $mockedService->translate('/something/something/thing');
        $this->assertEquals(new URLWildcardTranslationResult(array('uri' => '/long', 'forward' => false)), $translationResult);
    }