Example #1
0
 public function testGetOrderItemFromFactory()
 {
     $this->orderItemFactoryMock->expects($this->once())->method('create')->willReturn($this->orderItemMock);
     $this->orderItemMock->expects($this->once())->method('load')->with(1)->willReturn($this->orderItemMock);
     $this->item->setOrderItemId(1);
     $this->assertEquals($this->orderItemMock, $this->item->getOrderItem());
 }
Example #2
0
 /**
  * @expectedException \Magento\Framework\Exception\LocalizedException
  * @expectedExceptionMessage We found an invalid quantity to invoice item "Item Name".
  */
 public function testSetQtyWrongQty()
 {
     $this->orderItemFactoryMock->expects($this->once())->method('create')->willReturn($this->orderItemMock);
     $this->orderItemMock->expects($this->once())->method('load')->with(1)->willReturn($this->orderItemMock);
     $this->orderItemMock->expects($this->once())->method('getIsQtyDecimal')->willReturn(true);
     $this->orderItemMock->expects($this->once())->method('getQtyToInvoice')->willReturn(2);
     $this->orderItemMock->expects($this->once())->method('isDummy')->willReturn(false);
     $this->item->setOrderItemId(1);
     $this->item->setName('Item Name');
     $this->assertEquals($this->item->setQty(3), $this->item);
 }