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

testCreate() public method

public testCreate ( )
    public function testCreate()
    {
        $this->loggerMock->expects($this->once())->method('logCall');
        $cacheItemMock = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $this->cacheMock->expects($this->once())->method('getItem')->with('location', 33)->will($this->returnValue($cacheItemMock));
        $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('create')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Location\\CreateStruct'))->will($this->returnValue(new Location(array('id' => 33, 'contentId' => 2))));
        $cacheItemMock->expects($this->once())->method('set')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Location'))->will($this->returnValue($cacheItemMock));
        $cacheItemMock->expects($this->once())->method('save')->with();
        $cacheItemMock->expects($this->never())->method('get');
        $this->cacheMock->expects($this->at(1))->method('clear')->with('location', 'subtree')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(2))->method('clear')->with('content', 'locations', 2)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(3))->method('clear')->with('content', 2)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(4))->method('clear')->with('content', 'info', 2)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(5))->method('clear')->with('user', 'role', 'assignments', 'byGroup', 2)->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(6))->method('clear')->with('user', 'role', 'assignments', 'byGroup', 'inherited', 2)->will($this->returnValue(true));
        $handler = $this->persistenceCacheHandler->locationHandler();
        $handler->create(new CreateStruct());
    }