eZ\Publish\Core\Persistence\Legacy\Tests\Content\ObjectState\ObjectStateHandlerTest::testDelete PHP Method

testDelete() public method

public testDelete ( )
    public function testDelete()
    {
        $handler = $this->getObjectStateHandler();
        $mapperMock = $this->getMapperMock();
        $gatewayMock = $this->getGatewayMock();
        $gatewayMock->expects($this->once())->method('loadObjectStateData')->with($this->equalTo(1))->will($this->returnValue(array(array())));
        $mapperMock->expects($this->once())->method('createObjectStateFromData')->with($this->equalTo(array(array())))->will($this->returnValue(new ObjectState(array('id' => 1, 'groupId' => 2))));
        $gatewayMock->expects($this->once())->method('deleteObjectState')->with($this->equalTo(1));
        $gatewayMock->expects($this->any())->method('loadObjectStateListData')->with($this->equalTo(2))->will($this->returnValue(array(array())));
        $mapperMock->expects($this->any())->method('createObjectStateListFromData')->with($this->equalTo(array(array())))->will($this->returnValue(array(new ObjectState(array('id' => 2, 'groupId' => 2)))));
        $gatewayMock->expects($this->once())->method('updateObjectStatePriority')->with($this->equalTo(2), $this->equalTo(0));
        $gatewayMock->expects($this->once())->method('updateObjectStateLinks')->with($this->equalTo(1), $this->equalTo(2));
        $handler->delete(1);
    }