Skip to content

Commit c3c17a1

Browse files
committed
Merge remote-tracking branch 'origin/PHPUnit10_Deprecations' into Arrows_Delivery_07162024
2 parents 29fe909 + 4603a40 commit c3c17a1

File tree

1,217 files changed

+3611
-3518
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,217 files changed

+3611
-3518
lines changed

app/code/Magento/AdminAnalytics/Test/Unit/Condition/CanViewNotificationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function testIsVisibleLoadDataFromLog($expected, $cacheResponse, $logExis
7575
/**
7676
* @return array
7777
*/
78-
public function isVisibleProvider()
78+
public static function isVisibleProvider()
7979
{
8080
return [
8181
[true, false, false],

app/code/Magento/AdminNotification/Test/Unit/Model/FeedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ function ($initialValue, $item) use ($data) {
217217
/**
218218
* @return array
219219
*/
220-
public function checkUpdateDataProvider(): array
220+
public static function checkUpdateDataProvider(): array
221221
{
222222
return [
223223
[

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/CacheOutdatedTest.php

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,30 +60,37 @@ protected function setUp(): void
6060
* @param array $cacheTypes
6161
* @dataProvider getIdentityDataProvider
6262
*/
63-
public function testGetIdentity($expectedSum, $cacheTypes)
63+
public function testGetIdentity($expectedSum, $types)
6464
{
65+
$cacheType = [];
66+
foreach ($types as $type) {
67+
$cacheType[] = $type($this);
68+
}
69+
6570
$this->_cacheTypeListMock->method(
6671
'getInvalidated'
6772
)->willReturn(
68-
$cacheTypes
73+
$cacheType
6974
);
7075
$this->assertEquals($expectedSum, $this->_messageModel->getIdentity());
7176
}
7277

73-
/**
74-
* @return array
75-
*/
76-
public function getIdentityDataProvider()
78+
protected function getMockForStdClass($mockReturn)
7779
{
78-
$cacheTypeMock1 = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
80+
$cacheTypeMock = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
7981
->disableOriginalConstructor()
8082
->getMock();
81-
$cacheTypeMock1->method('getCacheType')->willReturn('Simple');
83+
$cacheTypeMock->method('getCacheType')->willReturn($mockReturn);
84+
return $cacheTypeMock;
85+
}
8286

83-
$cacheTypeMock2 = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
84-
->disableOriginalConstructor()
85-
->getMock();
86-
$cacheTypeMock2->method('getCacheType')->willReturn('Advanced');
87+
/**
88+
* @return array
89+
*/
90+
public static function getIdentityDataProvider()
91+
{
92+
$cacheTypeMock1 = static fn (self $testCase) => $testCase->getMockForStdClass('Simple');
93+
$cacheTypeMock2 = static fn (self $testCase) => $testCase->getMockForStdClass('Advanced');
8794

8895
return [
8996
['c13cfaddc2c53e8d32f59bfe89719beb', [$cacheTypeMock1]],
@@ -99,24 +106,25 @@ public function getIdentityDataProvider()
99106
*/
100107
public function testIsDisplayed($expected, $allowed, $cacheTypes)
101108
{
109+
$cacheType1 = [];
110+
foreach ($cacheTypes as $cacheType) {
111+
$cacheType1[] = $cacheType($this);
112+
}
102113
$this->_authorizationMock->expects($this->once())->method('isAllowed')->willReturn($allowed);
103114
$this->_cacheTypeListMock->method(
104115
'getInvalidated'
105116
)->willReturn(
106-
$cacheTypes
117+
$cacheType1
107118
);
108119
$this->assertEquals($expected, $this->_messageModel->isDisplayed());
109120
}
110121

111122
/**
112123
* @return array
113124
*/
114-
public function isDisplayedDataProvider()
125+
public static function isDisplayedDataProvider()
115126
{
116-
$cacheTypesMock = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
117-
->disableOriginalConstructor()
118-
->getMock();
119-
$cacheTypesMock->method('getCacheType')->willReturn('someVal');
127+
$cacheTypesMock = static fn (self $testCase) => $testCase->getMockForStdClass('someVal');
120128
$cacheTypes = [$cacheTypesMock, $cacheTypesMock];
121129
return [
122130
[false, false, []],

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/Media/Synchronization/ErrorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public function testIsDisplayed($expectedFirstRun, $data)
8282
/**
8383
* @return array
8484
*/
85-
public function isDisplayedDataProvider()
85+
public static function isDisplayedDataProvider()
8686
{
8787
return [
8888
[true, ['has_errors' => 1]],

app/code/Magento/AdminNotification/Test/Unit/Model/System/Message/SecurityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public function testIsDisplayed($expectedResult, $cached, $response)
8585
/**
8686
* @return array
8787
*/
88-
public function isDisplayedDataProvider()
88+
public static function isDisplayedDataProvider()
8989
{
9090
return [
9191
'cached_case' => [false, true, ''],

app/code/Magento/AdvancedSearch/Test/Unit/Model/Indexer/Fulltext/Plugin/CustomerGroupTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function testAroundSave(
118118
*
119119
* @return array
120120
*/
121-
public function aroundSaveDataProvider(): array
121+
public static function aroundSaveDataProvider(): array
122122
{
123123
return [
124124
[false, false, 0],

app/code/Magento/AdvancedSearch/Test/Unit/Model/ResourceModel/IndexTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public function testGetPriceIndexData(array $testData): void
155155
/**
156156
* @return array
157157
*/
158-
public function providerForTestPriceIndexData(): array
158+
public static function providerForTestPriceIndexData(): array
159159
{
160160
return [
161161
[

app/code/Magento/Analytics/Test/Unit/Controller/Adminhtml/Reports/ShowTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ public function testExecuteWithException(\Exception $exception)
141141
/**
142142
* @return array
143143
*/
144-
public function executeWithExceptionDataProvider()
144+
public static function executeWithExceptionDataProvider()
145145
{
146146
return [
147147
'ExecuteWithLocalizedException' => [new LocalizedException(__('TestMessage'))],

app/code/Magento/Analytics/Test/Unit/Controller/Adminhtml/Subscription/RetryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ public function testExecuteWithException(\Exception $exception, Phrase $message)
138138
/**
139139
* @return array
140140
*/
141-
public function executeExceptionsDataProvider()
141+
public static function executeExceptionsDataProvider()
142142
{
143143
return [
144144
[new LocalizedException(__('TestMessage')), __('TestMessage')],

app/code/Magento/Analytics/Test/Unit/Cron/CollectDataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testExecute($status)
8080
/**
8181
* @return array
8282
*/
83-
public function executeDataProvider()
83+
public static function executeDataProvider()
8484
{
8585
return [
8686
'Subscription is enabled' => [SubscriptionStatusProvider::ENABLED],

0 commit comments

Comments
 (0)