Skip to content

Commit c01fa68

Browse files
ShradddhaShradddha
authored andcommitted
AC-11979:: Remove Deprecations- PhpUnit10 Integration Tests
1 parent c4728de commit c01fa68

File tree

4 files changed

+40
-14
lines changed

4 files changed

+40
-14
lines changed

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTest/ProductOptionsTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1079,7 +1079,7 @@ public function testImportProductCustomOptionsOnMultipleUploads(
10791079
/**
10801080
* @return array
10811081
*/
1082-
public function getProductCustomOptionDataProvider(): array
1082+
public static function getProductCustomOptionDataProvider(): array
10831083
{
10841084
return [
10851085
[

dev/tests/integration/testsuite/Magento/Framework/DB/Adapter/Pdo/MysqlTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ public static function getAutoIncrementFieldDataProvider()
284284
{
285285
return [
286286
'auto increment field' => [
287-
'field options' => ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
288-
'expected result' => 'row_id',
287+
'options' => ['identity' => true, 'unsigned' => true, 'nullable' => false, 'primary' => true],
288+
'expected' => 'row_id',
289289
],
290290
'non auto increment field' => [
291-
'field options' => ['unsigned' => true, 'nullable' => false,],
292-
'expected result' => false,
291+
'options' => ['unsigned' => true, 'nullable' => false,],
292+
'expected' => false,
293293
]
294294
];
295295
}

dev/tests/integration/testsuite/Magento/Quote/Model/QuoteMutexTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,14 @@ class QuoteMutexTest extends \PHPUnit\Framework\TestCase
2222
*/
2323
private $quoteMutex;
2424

25+
private static $quoteMutexClass;
26+
2527
protected function setUp(): void
2628
{
2729
$objectManager = BootstrapHelper::getObjectManager();
2830
$this->quoteMutex = $objectManager->create(QuoteMutexInterface::class);
2931
$this->guestCartManagement = $objectManager->create(GuestCartManagementInterface::class);
32+
self::$quoteMutexClass = $this;
3033
}
3134

3235
/**
@@ -49,7 +52,7 @@ public function testSuccessfulExecution(callable $callable, array $args, $expect
4952
/**
5053
* @return array[]
5154
*/
52-
public function callableDataProvider(): array
55+
public static function callableDataProvider(): array
5356
{
5457
$functionWithArgs = function (int $a, int $b) {
5558
return $a + $b;
@@ -63,7 +66,7 @@ public function callableDataProvider(): array
6366
['callable' => $functionWithoutArgs, 'args' => [], 'expectedResult' => 'Function without args'],
6467
['callable' => $functionWithArgs, 'args' => [1,2], 'expectedResult' => 3],
6568
[
66-
'callable' => \Closure::fromCallable([$this, 'privateMethod']),
69+
'callable' => \Closure::fromCallable([QuoteMutexTest::class, 'privateMethod']),
6770
'args' => ['test'],
6871
'expectedResult' => 'test'
6972
],
@@ -77,7 +80,7 @@ public function callableDataProvider(): array
7780
* @return string
7881
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
7982
*/
80-
private function privateMethod(string $var)
83+
private static function privateMethod(string $var)
8184
{
8285
return $var;
8386
}

dev/tests/integration/testsuite/Magento/SalesRule/Plugin/CouponUsagesTest.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,15 @@ public function testSubmitQuoteAndCancelOrder()
166166
*/
167167
public function testQuoteSubmitFailure(array $mockObjects)
168168
{
169+
if(!empty($mockObjects['orderManagement']))
170+
{
171+
$mockObjects['orderManagement'] = $mockObjects['orderManagement']($this);
172+
}
173+
else if(!empty($mockObjects['submitQuoteValidator']))
174+
{
175+
$mockObjects['submitQuoteValidator'] = $mockObjects['submitQuoteValidator']($this);
176+
}
177+
169178
$customerId = 1;
170179
$couponCode = 'one_usage';
171180
$reservedOrderId = 'test01';
@@ -200,23 +209,37 @@ public function testQuoteSubmitFailure(array $mockObjects)
200209
}
201210
}
202211

203-
/**
204-
* @return array
205-
*/
206-
public function quoteSubmitFailureDataProvider(): array
212+
private function getMockForOrderManageClass()
207213
{
208-
/** @var OrderManagementInterface|MockObject $orderManagement */
209214
$orderManagement = $this->createMock(OrderManagementInterface::class);
210215
$orderManagement->expects($this->once())
211216
->method('place')
212217
->willThrowException(new \Exception());
213218

214-
/** @var OrderManagementInterface|MockObject $orderManagement */
219+
return $orderManagement;
220+
}
221+
222+
private function getSubmitQuoteValidatorClass()
223+
{
215224
$submitQuoteValidator = $this->createMock(SubmitQuoteValidator::class);
216225
$submitQuoteValidator->expects($this->once())
217226
->method('validateQuote')
218227
->willThrowException(new \Exception());
219228

229+
return $submitQuoteValidator;
230+
}
231+
232+
/**
233+
* @return array
234+
*/
235+
public static function quoteSubmitFailureDataProvider(): array
236+
{
237+
/** @var OrderManagementInterface|MockObject $orderManagement */
238+
$orderManagement = static fn (self $testCase) => $testCase->getMockForOrderManageClass();
239+
240+
/** @var OrderManagementInterface|MockObject $orderManagement */
241+
$submitQuoteValidator = static fn (self $testCase) => $testCase->getSubmitQuoteValidatorClass();
242+
220243
return [
221244
'order placing failure' => [
222245
['orderManagement' => $orderManagement]

0 commit comments

Comments
 (0)