eZ\Publish\Core\Persistence\Cache\Tests\ContentHandlerTest::testPublish PHP Метод

testPublish() публичный Метод

public testPublish ( )
    public function testPublish()
    {
        $this->loggerMock->expects($this->once())->method('logCall');
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Handler');
        $this->persistenceHandlerMock->expects($this->once())->method('contentHandler')->will($this->returnValue($innerHandlerMock));
        $innerHandlerMock->expects($this->once())->method('publish')->with(2, 1, $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\MetadataUpdateStruct'))->will($this->returnValue(new Content(array('fields' => array(), 'versionInfo' => new VersionInfo(array('versionNo' => 1, 'contentInfo' => new ContentInfo(array('id' => 2))))))));
        $this->cacheMock->expects($this->at(0))->method('clear')->with('content', 2)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(1))->method('clear')->with('content', 'info', 'remoteId')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(2))->method('clear')->with('location', 'subtree')->will($this->returnValue(true));
        $cacheItemMock = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $this->cacheMock->expects($this->at(3))->method('getItem')->with('content', 2, 1, ContentHandler::ALL_TRANSLATIONS_KEY)->will($this->returnValue($cacheItemMock));
        $cacheItemMock->expects($this->once())->method('set')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content'))->will($this->returnValue($cacheItemMock));
        $cacheItemMock->expects($this->once())->method('save')->with();
        $cacheItemMock->expects($this->never())->method('get');
        $cacheItemMock2 = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $this->cacheMock->expects($this->at(4))->method('getItem')->with('content', 'info', 2)->will($this->returnValue($cacheItemMock2));
        $cacheItemMock2->expects($this->once())->method('set')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\ContentInfo'))->will($this->returnValue($cacheItemMock2));
        $cacheItemMock2->expects($this->once())->method('save')->with();
        $cacheItemMock2->expects($this->never())->method('get');
        $handler = $this->persistenceCacheHandler->contentHandler();
        $handler->publish(2, 1, new MetadataUpdateStruct());
    }