eZ\Publish\Core\Persistence\Cache\Tests\UrlAliasHandlerTest::testLookupIsMissHistory PHP Method

testLookupIsMissHistory() public method

    public function testLookupIsMissHistory()
    {
        $urlAlias = new UrlAlias(['id' => 55, 'isHistory' => true]);
        $this->loggerMock->expects($this->once())->method('logCall');
        $missedUrlAliasIdCacheItem = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $missedUrlAliasIdCacheItem->expects($this->once())->method('get')->will($this->returnValue(null));
        $missedUrlAliasIdCacheItem->expects($this->once())->method('isMiss')->will($this->returnValue(true));
        $historyUrlAliasCacheItem = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $historyUrlAliasCacheItem->expects($this->once())->method('get')->will($this->returnValue(null));
        $historyUrlAliasCacheItem->expects($this->once())->method('isMiss')->will($this->returnValue(true));
        $historyUrlAliasCacheItem->expects($this->once())->method('set')->with($urlAlias)->will($this->returnValue($historyUrlAliasCacheItem));
        $historyUrlAliasCacheItem->expects($this->once())->method('save')->with();
        $this->cacheMock->expects($this->at(0))->method('getItem')->with('urlAlias', 'url', '/url')->will($this->returnValue($missedUrlAliasIdCacheItem));
        $this->cacheMock->expects($this->at(1))->method('getItem')->with('urlAlias', 'url', 'history', '/url')->will($this->returnValue($historyUrlAliasCacheItem));
        $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\UrlAlias\\Handler');
        $this->persistenceHandlerMock->expects($this->once())->method('urlAliasHandler')->will($this->returnValue($innerHandler));
        $innerHandler->expects($this->once())->method('lookup')->with('/url')->will($this->returnValue($urlAlias));
        $handler = $this->persistenceCacheHandler->urlAliasHandler();
        $handler->lookup('/url');
    }