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

testSetPriority() public method

public testSetPriority ( )
    public function testSetPriority()
    {
        $handler = $this->getObjectStateHandler();
        $mapperMock = $this->getMapperMock();
        $gatewayMock = $this->getGatewayMock();
        $gatewayMock->expects($this->once())->method('loadObjectStateData')->with($this->equalTo(2))->will($this->returnValue(array(array())));
        $mapperMock->expects($this->once())->method('createObjectStateFromData')->with($this->equalTo(array(array())))->will($this->returnValue(new ObjectState(array('id' => 2, 'groupId' => 2))));
        $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' => 1, 'groupId' => 2)), new ObjectState(array('id' => 2, 'groupId' => 2)), new ObjectState(array('id' => 3, 'groupId' => 2)))));
        $gatewayMock->expects($this->exactly(3))->method('updateObjectStatePriority');
        $gatewayMock->expects($this->at(2))->method('updateObjectStatePriority')->with($this->equalTo(2), $this->equalTo(0));
        $gatewayMock->expects($this->at(3))->method('updateObjectStatePriority')->with($this->equalTo(1), $this->equalTo(1));
        $gatewayMock->expects($this->at(4))->method('updateObjectStatePriority')->with($this->equalTo(3), $this->equalTo(2));
        $handler->setPriority(2, 0);
    }