eZ\Publish\Core\Persistence\Cache\Tests\ObjectStateHandlerTest::testCreate PHP Метод

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

public testCreate ( )
    public function testCreate()
    {
        $inputStruct = new SPIInputStruct(array('identifier' => 'test_state', 'name' => 'Test State'));
        $expectedState = new SPIObjectState(array('id' => 1, 'identifier' => 'test_state', 'name' => 'Test State', 'groupId' => 1));
        $this->loggerMock->expects($this->once())->method('logCall');
        $innerHandlerMock = $this->getMock('eZ\\Publish\\SPI\\Persistence\\Content\\ObjectState\\Handler');
        $this->persistenceHandlerMock->expects($this->once())->method('objectStateHandler')->will($this->returnValue($innerHandlerMock));
        $innerHandlerMock->expects($this->once())->method('create')->with(1, $inputStruct)->will($this->returnValue($expectedState));
        $cacheItemMock = $this->getMock('Stash\\Interfaces\\ItemInterface');
        $this->cacheMock->expects($this->at(0))->method('clear')->with('objectstate', 'byGroup', 1);
        $handler = $this->persistenceCacheHandler->objectStateHandler();
        $state = $handler->create(1, $inputStruct);
        $this->assertEquals($state, $expectedState);
    }