eZ\Publish\Core\Persistence\Cache\Tests\ContentTypeHandlerTest::testUpdate PHP Method

testUpdate() public method

public testUpdate ( )
    public function testUpdate()
    {
        $this->loggerMock->expects($this->once())->method('logCall');
        $cacheItemMock = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $this->cacheMock->expects($this->at(0))->method('getItem')->with('contentType', 55)->will($this->returnValue($cacheItemMock));
        $this->cacheMock->expects($this->at(1))->method('clear')->with('contentType', 'identifier')->will($this->returnValue(true));
        $this->cacheMock->expects($this->at(2))->method('clear')->with('searchableFieldMap')->will($this->returnValue(true));
        $innerHandler = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\Handler');
        $this->persistenceHandlerMock->expects($this->once())->method('contentTypeHandler')->will($this->returnValue($innerHandler));
        $innerHandler->expects($this->once())->method('update')->with(55, SPIType::STATUS_DEFINED, $this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type\\UpdateStruct'))->will($this->returnValue(new SPIType(array('id' => 55, 'name' => 'Forum', 'identifier' => 'forum'))));
        $cacheItemMock->expects($this->once())->method('set')->with($this->isInstanceOf('eZ\\Publish\\SPI\\Persistence\\Content\\Type'))->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(3))->method('getItem')->with('contentType', 'identifier', 'forum')->will($this->returnValue($cacheItemMock2));
        $cacheItemMock2->expects($this->once())->method('set')->with(55)->will($this->returnValue($cacheItemMock2));
        $cacheItemMock2->expects($this->once())->method('save')->with();
        $cacheItemMock2->expects($this->never())->method('get');
        $handler = $this->persistenceCacheHandler->contentTypeHandler();
        $handler->update(55, SPIType::STATUS_DEFINED, new SPITypeUpdateStruct());
    }