Skip to content

Commit

Permalink
[ECP-9078] Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Can Demiralp committed Feb 18, 2025
1 parent 5209b00 commit 6dd4f93
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions Test/Unit/Helper/PaymentMethodsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -956,12 +956,20 @@ public function testIsAutoCapture(
$paymentCode,
$autoCaptureOpenInvoice,
$manualCapturePayPal,
$expectedResult
$expectedResult,
$isOpenInvoicePaymentMethod
) {
// Reset Config mock to prevent interventions with other expects() assertions.
$this->configHelperMock = $this->createMock(Config::class);

$paymentMethodInstanceMock = $this->createMock(MethodInterface::class);
$paymentMethodInstanceMock->method('getConfigData')->with(PaymentMethods::CONFIG_FIELD_IS_OPEN_INVOICE)->willReturn($isOpenInvoicePaymentMethod);

$paymentMock = $this->createMock(Order\Payment::class);
$paymentMock->method('getMethodInstance')->willReturn($paymentMethodInstanceMock);

$this->orderMock->method('getStoreId')->willReturn(1);
$this->orderMock->method('getPayment')->willReturn($paymentMock);

$this->configHelperMock->expects($this->any())
->method('getConfigData')
Expand Down Expand Up @@ -1004,11 +1012,13 @@ public function autoCaptureDataProvider(): array
{
return [
// Manual capture supported, capture mode manual, sepa flow not authcap
[true, 'manual', 'notauthcap', 'paypal', true, null, true],
[true, 'manual', 'notauthcap', 'paypal', true, null, true, false],
// Manual capture supported, capture mode auto
[true, 'auto', '', 'sepadirectdebit', true, null, true],
[true, 'auto', '', 'sepadirectdebit', true, null, true, false],
// Manual capture supported open invoice
[true, 'manual', '', 'klarna', false, null, false, true],
// Manual capture not supported
[false, '', '', 'sepadirectdebit', true, null, true]
[false, '', '', 'sepadirectdebit', true, null, true, false]
];
}

Expand Down

0 comments on commit 6dd4f93

Please sign in to comment.