Skip to content

Commit a46b12b

Browse files
committed
AC-15105: [CE] PHPUnit 12: Upgrade Payment & Shipping related test cases
1 parent c76f1b3 commit a46b12b

File tree

4 files changed

+70
-8
lines changed

4 files changed

+70
-8
lines changed

app/code/Magento/CardinalCommerce/Test/Unit/Model/Response/JwtPayloadValidatorTest.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\CardinalCommerce\Test\Unit\Model\Response;
99

10+
use DateTimeZone;
1011
use Magento\CardinalCommerce\Model\Response\JwtPayloadValidator;
1112
use Magento\Framework\Intl\DateTimeFactory;
1213
use PHPUnit\Framework\TestCase;
@@ -29,7 +30,7 @@ protected function setUp(): void
2930

3031
/**
3132
* Tests successful cases.
32-
*
33+
*
3334
* @param array $token
3435
*/
3536
#[DataProvider('validateSuccessDataProvider')]
@@ -62,6 +63,9 @@ public static function validateSuccessDataProvider()
6263

6364
/**
6465
* Case when 3DS authentication is either failed or could not be attempted.
66+
*
67+
* @param array $token
68+
* @dataProvider validationEciFailsDataProvider
6569
*/
6670
#[DataProvider('validationEciFailsDataProvider')]
6771
public function testValidationEciFails(array $token)
@@ -90,7 +94,7 @@ public static function validationEciFailsDataProvider(): array
9094

9195
/**
9296
* Case when resulting state of the transaction is negative.
93-
*
97+
*
9498
* @param array $token
9599
*/
96100
#[DataProvider('validationActionCodeFailsDataProvider')]
@@ -179,7 +183,7 @@ private static function createToken(string $eciFlag, string $errorNumber, string
179183
private static function getValidExpTimestamp()
180184
{
181185
$dateTimeFactory = new DateTimeFactory();
182-
$currentDate = $dateTimeFactory->create('now', new \DateTimeZone('UTC'));
186+
$currentDate = $dateTimeFactory->create('now', new DateTimeZone('UTC'));
183187

184188
return $currentDate->getTimestamp() + 3600;
185189
}
@@ -192,7 +196,7 @@ private static function getValidExpTimestamp()
192196
private function getOutdatedExpTimestamp()
193197
{
194198
$dateTimeFactory = new DateTimeFactory();
195-
$currentDate = $dateTimeFactory->create('now', new \DateTimeZone('UTC'));
199+
$currentDate = $dateTimeFactory->create('now', new DateTimeZone('UTC'));
196200

197201
return $currentDate->getTimestamp() - 3600;
198202
}

app/code/Magento/Payment/Test/Unit/Model/Method/FreeTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ protected function setUp(): void
8282

8383
/**
8484
* Test get config payment action
85+
*
86+
* @param string $orderStatus
87+
* @param string $paymentAction
88+
* @param string|null $result
89+
* @return void
8590
*/
8691
#[DataProvider('getConfigPaymentActionProvider')]
8792
public function testGetConfigPaymentAction($orderStatus, $paymentAction, $result): void

app/code/Magento/Payment/Test/Unit/Model/PaymentMethodListTest.php

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,12 @@ private function setUpGetList($paymentMethodConfig, $methodInstancesMap)
9595

9696
/**
9797
* Test getList.
98+
*
99+
* @param int $storeId
100+
* @param array $paymentMethodConfig
101+
* @param array $methodInstancesMap
102+
* @param array $expected
103+
* @return void
98104
*/
99105
#[DataProvider('getListDataProvider')]
100106
public function testGetList($storeId, $paymentMethodConfig, $methodInstancesMap, $expected)
@@ -130,8 +136,26 @@ public static function getListDataProvider()
130136
1,
131137
['method_code_1' => [], 'method_code_2' => []],
132138
[
133-
['method_code_1', static fn (self $testCase) => $testCase->mockPaymentMethodInstance(1, 10, 'method_code_1', 'title', true)],
134-
['method_code_2', static fn (self $testCase) => $testCase->mockPaymentMethodInstance(1, 5, 'method_code_2', 'title', true)]
139+
[
140+
'method_code_1',
141+
static fn (self $testCase) => $testCase->mockPaymentMethodInstance(
142+
1,
143+
10,
144+
'method_code_1',
145+
'title',
146+
true
147+
)
148+
],
149+
[
150+
'method_code_2',
151+
static fn (self $testCase) => $testCase->mockPaymentMethodInstance(
152+
1,
153+
5,
154+
'method_code_2',
155+
'title',
156+
true
157+
)
158+
]
135159
],
136160
['method_code_2', 'method_code_1']
137161
]
@@ -140,6 +164,12 @@ public static function getListDataProvider()
140164

141165
/**
142166
* Test getActiveList.
167+
*
168+
* @param int $storeId
169+
* @param array $paymentMethodConfig
170+
* @param array $methodInstancesMap
171+
* @param array $expected
172+
* @return void
143173
*/
144174
#[DataProvider('getActiveListDataProvider')]
145175
public function testGetActiveList($storeId, $paymentMethodConfig, $methodInstancesMap, $expected)
@@ -175,8 +205,26 @@ public static function getActiveListDataProvider()
175205
1,
176206
['method_code_1' => [], 'method_code_2' => []],
177207
[
178-
['method_code_1', static fn (self $testCase) => $testCase->mockPaymentMethodInstance(1, 10, 'method_code_1', 'title', false)],
179-
['method_code_2', static fn (self $testCase) => $testCase->mockPaymentMethodInstance(1, 5, 'method_code_2', 'title', true)]
208+
[
209+
'method_code_1',
210+
static fn (self $testCase) => $testCase->mockPaymentMethodInstance(
211+
1,
212+
10,
213+
'method_code_1',
214+
'title',
215+
false
216+
)
217+
],
218+
[
219+
'method_code_2',
220+
static fn (self $testCase) => $testCase->mockPaymentMethodInstance(
221+
1,
222+
5,
223+
'method_code_2',
224+
'title',
225+
true
226+
)
227+
]
180228
],
181229
['method_code_2']
182230
]

app/code/Magento/Payment/Test/Unit/Plugin/PaymentConfigurationProcessTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ protected function setUp(): void
6767

6868
/**
6969
* Test before process
70+
*
71+
* @param array $jsLayout
72+
* @param array $activePaymentList
73+
* @param array $expectedResult
74+
* @return void
7075
*/
7176
#[DataProvider('beforeProcessDataProvider')]
7277
public function testBeforeProcess($jsLayout, $activePaymentList, $expectedResult)

0 commit comments

Comments
 (0)