@@ -343,74 +343,20 @@ public function testRefundExpectsMoneyAvailableToReturn()
343
343
->willReturn ($ order );
344
344
$ creditMemo ->method ('getBaseGrandTotal ' )
345
345
->willReturn ($ baseGrandTotal );
346
- $ creditMemo ->method ('getGrandTotal ' )
347
- ->willReturn ($ baseGrandTotal );
348
346
$ order ->method ('getBaseTotalRefunded ' )
349
347
->willReturn ($ baseTotalRefunded );
350
- $ order ->method ('getTotalRefunded ' )
351
- ->willReturn ($ baseTotalRefunded );
352
348
$ this ->priceCurrency ->method ('round ' )
353
349
->withConsecutive ([$ baseTotalRefunded + $ baseGrandTotal ], [$ baseTotalPaid ])
354
350
->willReturnOnConsecutiveCalls ($ baseTotalRefunded + $ baseGrandTotal , $ baseTotalPaid );
355
351
$ order ->method ('getBaseTotalPaid ' )
356
352
->willReturn ($ baseTotalPaid );
357
- $ order ->method ('getTotalPaid ' )
358
- ->willReturn ($ baseTotalPaid );
359
353
$ baseAvailableRefund = $ baseTotalPaid - $ baseTotalRefunded ;
360
354
$ order ->method ('formatPriceTxt ' )
361
355
->with ($ baseAvailableRefund )
362
356
->willReturn ($ baseAvailableRefund );
363
357
$ this ->creditmemoService ->refund ($ creditMemo , true );
364
358
}
365
359
366
- /**
367
- * @expectedExceptionMessage The most money available to refund is €0.88.
368
- * @expectedException \Magento\Framework\Exception\LocalizedException
369
- */
370
- public function testMultiCurrencyRefundExpectsMoneyAvailableToReturn ()
371
- {
372
- $ baseGrandTotal = 10.00 ;
373
- $ baseTotalRefunded = 9.00 ;
374
- $ baseTotalPaid = 10 ;
375
-
376
- $ grandTotal = 8.81 ;
377
- $ totalRefunded = 7.929 ;
378
- $ totalPaid = 8.81 ;
379
-
380
- /** @var CreditmemoInterface|MockObject $creditMemo */
381
- $ creditMemo = $ this ->getMockBuilder (CreditmemoInterface::class)
382
- ->setMethods (['getId ' , 'getOrder ' ])
383
- ->getMockForAbstractClass ();
384
- $ creditMemo ->method ('getId ' )
385
- ->willReturn (null );
386
- /** @var Order|MockObject $order */
387
- $ order = $ this ->getMockBuilder (Order::class)
388
- ->disableOriginalConstructor ()
389
- ->getMock ();
390
- $ creditMemo ->method ('getOrder ' )
391
- ->willReturn ($ order );
392
- $ creditMemo ->method ('getBaseGrandTotal ' )
393
- ->willReturn ($ baseGrandTotal );
394
- $ creditMemo ->method ('getGrandTotal ' )
395
- ->willReturn ($ grandTotal );
396
- $ order ->method ('getBaseTotalRefunded ' )
397
- ->willReturn ($ baseTotalRefunded );
398
- $ order ->method ('getTotalRefunded ' )
399
- ->willReturn ($ totalRefunded );
400
- $ this ->priceCurrency ->method ('round ' )
401
- ->withConsecutive ([$ baseTotalRefunded + $ baseGrandTotal ], [$ baseTotalPaid ])
402
- ->willReturnOnConsecutiveCalls ($ baseTotalRefunded + $ baseGrandTotal , $ baseTotalPaid );
403
- $ order ->method ('getBaseTotalPaid ' )
404
- ->willReturn ($ baseTotalPaid );
405
- $ order ->method ('getTotalPaid ' )
406
- ->willReturn ($ totalPaid );
407
- $ availableRefund = $ totalPaid - $ totalRefunded ;
408
- $ order ->method ('formatPriceTxt ' )
409
- ->with ($ availableRefund )
410
- ->willReturn (sprintf ('€%.2f ' , $ availableRefund ));
411
- $ this ->creditmemoService ->refund ($ creditMemo , true );
412
- }
413
-
414
360
/**
415
361
* @expectedExceptionMessage We cannot register an existing credit memo.
416
362
* @expectedException \Magento\Framework\Exception\LocalizedException
0 commit comments