eZ\Publish\Core\Persistence\Cache\Tests\LocationHandlerTest::testSwap PHP Method

testSwap() public method

public testSwap ( )
    public function testSwap()
    {
        $this->loggerMock->expects($this->once())->method('logCall');
        $this->cacheMock->expects($this->at(0))->method('clear')->with('location', 33)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(1))->method('clear')->with('location', 66)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(2))->method('clear')->with('location', 'subtree')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(3))->method('clear')->with('content', 'locations')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(4))->method('clear')->with('user', 'role', 'assignments', 'byGroup')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(5))->method('clear')->with('content', $this->isType('integer'))->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(6))->method('clear')->with('content', $this->isType('integer'))->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(7))->method('clear')->with('content', 'info', $this->isType('integer'))->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(8))->method('clear')->with('content', 'info', $this->isType('integer'))->will($this->returnValue(true));
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\Handler');
        $this->persistenceHandlerMock->expects($this->once())->method('locationHandler')->will($this->returnValue($innerHandlerMock));
        $innerHandlerMock->expects($this->once())->method('swap')->with(33, 66)->will($this->returnValue(true));
        $locationMock = $this->getMock('eZ\\Publish\\API\\Repository\\Values\\Content\\Location');
        $locationMock->expects($this->any())->method('__get')->with('contentId')->will($this->returnValue(42));
        /** @var \eZ\Publish\SPI\Persistence\Content\Location\Handler|\PHPUnit_Framework_MockObject_MockObject $handler */
        $handler = $this->getMockBuilder('eZ\\Publish\\Core\\Persistence\\Cache\\LocationHandler')->setMethods(['load'])->setConstructorArgs([$this->cacheMock, $this->persistenceHandlerMock, $this->loggerMock])->getMock();
        $handler->expects($this->any())->method('load')->will($this->returnValue($locationMock));
        $handler->swap(33, 66);
    }