示例#1
0
 public function testCalcRowTotal()
 {
     $this->item->setData(['order_item_id' => 1, 'qty' => 2]);
     $this->item->setInvoice($this->invoiceMock);
     $this->invoiceMock->expects($this->once())->method('getOrder')->willReturn($this->orderMock);
     $this->orderMock->expects($this->once())->method('getItemById')->with(1)->willReturn($this->orderItemMock);
     $this->orderItemMock->expects($this->once())->method('getQtyOrdered')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getRowTotal')->willReturn(2);
     $this->orderItemMock->expects($this->once())->method('getRowInvoiced')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getBaseRowTotal')->willReturn(2);
     $this->orderItemMock->expects($this->once())->method('getBaseRowInvoiced')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getRowTotalInclTax')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getBaseRowTotalInclTax')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getQtyToInvoice')->willReturn(1);
     $this->orderItemMock->expects($this->once())->method('getQtyInvoiced')->willReturn(0);
     $this->invoiceMock->expects($this->exactly(4))->method('roundPrice')->willReturnMap([[2, 'regular', false, 2], [2, 'base', false, 2], [2, 'including', false, 2], [2, 'including_base', false, 2]]);
     $this->assertEquals($this->item->calcRowTotal(), $this->item);
 }