/** * test check order - set state processing */ public function testCheckSetStateProcessing() { $this->orderMock->expects($this->once())->method('getId')->will($this->returnValue(1)); $this->orderMock->expects($this->once())->method('isCanceled')->will($this->returnValue(false)); $this->orderMock->expects($this->once())->method('canUnhold')->will($this->returnValue(false)); $this->orderMock->expects($this->once())->method('canInvoice')->will($this->returnValue(false)); $this->orderMock->expects($this->once())->method('canShip')->will($this->returnValue(true)); $this->orderMock->expects($this->once())->method('getState')->will($this->returnValue(Order::STATE_NEW)); $this->orderMock->expects($this->once())->method('getIsInProcess')->will($this->returnValue(true)); $this->orderMock->expects($this->once())->method('setState')->with(Order::STATE_PROCESSING)->will($this->returnSelf()); $this->assertEquals($this->state, $this->state->check($this->orderMock)); }
/** * {@inheritdoc} */ public function save(\Magento\Framework\Model\AbstractModel $object) { /** @var \Magento\Sales\Model\Order $object */ $this->stateHandler->check($object); return parent::save($object); }