Skip to content

Commit 0c697de

Browse files
MC-41438: 100% Discount cart rule results in Tax invoiced
1 parent df1a501 commit 0c697de

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

app/code/Magento/Sales/Test/Unit/Model/Order/Invoice/Total/DiscountTest.php

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,43 @@ public function testCollectInvoiceWithZeroGrandTotal(array $invoiceData): void
9898
$this->model->collect($this->invoice);
9999
}
100100

101+
/**
102+
* Test for collect invoice with negative grand total
103+
*
104+
* @return void
105+
*/
106+
public function testCollectInvoiceWithNegativeGrandTotal(): void
107+
{
108+
$invoiceData = [
109+
'order_item' => [
110+
'qty_ordered' => 1,
111+
'discount_amount' => 25.34,
112+
'base_discount_amount' => 25.34,
113+
],
114+
'is_last' => true,
115+
'qty' => 1,
116+
];
117+
$invoiceItem[] = $this->getInvoiceItem($invoiceData);
118+
$this->invoice->method('getOrder')
119+
->willReturn($this->order);
120+
$this->order->method('getInvoiceCollection')
121+
->willReturn([]);
122+
$this->invoice->method('getAllItems')
123+
->willReturn($invoiceItem);
124+
$this->invoice->method('getGrandTotal')
125+
->willReturn(15.6801);
126+
$this->invoice->method('getBaseGrandTotal')
127+
->willReturn(15.6801);
128+
129+
$this->invoice->expects($this->exactly(1))
130+
->method('setGrandTotal')
131+
->with(-9.6599);
132+
$this->invoice->expects($this->exactly(1))
133+
->method('setBaseGrandTotal')
134+
->with(-9.6599);
135+
$this->model->collect($this->invoice);
136+
}
137+
101138
/**
102139
* @return array
103140
*/

0 commit comments

Comments
 (0)