public function testInvoke() { $id = 1; $dataObject = $this->getMock('Magento\\Sales\\Service\\V1\\Data\\OrderStatusHistory', [], [], '', false); $model = $this->getMock('Magento\\Sales\\Model\\Order\\Status\\History', [], [], '', false); $this->historyConverterMock->expects($this->once())->method('getModel')->with($dataObject)->will($this->returnValue($model)); $orderMock = $this->getMock('Magento\\Sales\\Model\\Order', [], [], '', false); $orderMock->expects($this->once())->method('addStatusHistory')->with($model); $this->orderRepositoryMock->expects($this->once())->method('get')->with($id)->will($this->returnValue($orderMock)); $this->assertTrue($this->service->invoke($id, $dataObject)); }
/** * @param int $id * @param \Magento\Sales\Service\V1\Data\OrderStatusHistory $statusHistory * @return bool */ public function statusHistoryAdd($id, OrderStatusHistory $statusHistory) { return $this->orderStatusHistoryAdd->invoke($id, $statusHistory); }
/** * test order status history add */ public function testStatusHistoryAdd() { $statusHistory = $this->getMock('Magento\\Sales\\Service\\V1\\Data\\OrderStatusHistory', [], [], '', false); $this->orderStatusHistoryAddMock->expects($this->once())->method('invoke')->with(1, $statusHistory)->will($this->returnValue(true)); $this->assertTrue($this->orderWrite->statusHistoryAdd(1, $statusHistory)); }