Example #1
0
 public function testGetTaxItemsByOrderId()
 {
     $orderId = 1;
     $taxItems = [['tax_id' => 1, 'tax_percent' => 5, 'item_id' => 1, 'taxable_item_type' => 4, 'associated_item_id' => 1, 'real_amount' => 12, 'real_base_amount' => 12]];
     $select = $this->getMock('Magento\\Framework\\DB\\Select', [], [], '', false);
     $this->connectionMock->expects($this->once())->method('select')->willReturn($select);
     $select->expects($this->once())->method('from')->with(['item' => 'sales_order_tax_item'], ['tax_id', 'tax_percent', 'item_id', 'taxable_item_type', 'associated_item_id', 'real_amount', 'real_base_amount'])->willReturnSelf();
     $select->expects($this->once())->method('join')->with(['tax' => 'sales_order_tax'], 'item.tax_id = tax.tax_id', ['code', 'title', 'order_id'])->willReturnSelf();
     $select->expects($this->once())->method('where')->with('tax.order_id = ?', $orderId)->willReturnSelf();
     $this->connectionMock->expects($this->once())->method('fetchAll')->with($select)->willReturn($taxItems);
     $this->assertEquals($taxItems, $this->taxItem->getTaxItemsByOrderId($orderId));
 }