Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/code/Magento/Sales/Model/RefundInvoice.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ public function execute(
$invoice->getBaseTotalRefunded() + $creditmemo->getBaseGrandTotal()
);
}
$creditmemo->setInvoiceId($invoice->getId());
$this->invoiceRepository->save($invoice);
$order = $this->orderRepository->save($order);
$creditmemo = $this->creditmemoRepository->save($creditmemo);
Expand Down
6 changes: 5 additions & 1 deletion app/code/Magento/Sales/Test/Unit/Model/RefundInvoiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class RefundInvoiceTest extends \PHPUnit\Framework\TestCase
private $orderMock;

/**
* @var OrderInterface|\PHPUnit_Framework_MockObject_MockObject
* @var InvoiceInterface|\PHPUnit_Framework_MockObject_MockObject
*/
private $invoiceMock;

Expand Down Expand Up @@ -186,6 +186,7 @@ protected function setUp()
->getMockForAbstractClass();

$this->invoiceMock = $this->getMockBuilder(InvoiceInterface::class)
->setMethods(['getId'])
->disableOriginalConstructor()
->getMockForAbstractClass();

Expand Down Expand Up @@ -239,6 +240,9 @@ public function testOrderCreditmemo($invoiceId, $isOnline, $items, $notify, $app
$this->invoiceRepositoryMock->expects($this->once())
->method('get')
->willReturn($this->invoiceMock);
$this->invoiceMock->expects($this->once())
->method('getId')
->willReturn($invoiceId);
$this->orderRepositoryMock->expects($this->once())
->method('get')
->willReturn($this->orderMock);
Expand Down