コード例 #1
0
ファイル: ItemTest.php プロジェクト: shabbirvividads/magento2
 /**
  * @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);
 }
コード例 #2
0
ファイル: ItemTest.php プロジェクト: Doability/magento2dev
 public function testSetQty()
 {
     $qty = 3;
     $this->assertEquals($this->item->setQty($qty), $this->item);
     $this->assertEquals($this->item->getQty(), $qty);
 }