Skip to content

Commit 170ec99

Browse files
ShradddhaShradddha
authored andcommitted
AC-12092:: Remove Deprecations- PhpUnit10 Unit Tests
1 parent 718aff1 commit 170ec99

File tree

411 files changed

+782
-772
lines changed

Some content is hidden

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

411 files changed

+782
-772
lines changed

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: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,21 @@ protected function setUp(): void
5757

5858
/**
5959
* @param string $expectedSum
60-
* @param array $cacheTypes
60+
* @param array $types
6161
* @dataProvider getIdentityDataProvider
6262
*/
63-
public function testGetIdentity($expectedSum, $cacheTypes)
63+
public function testGetIdentity($expectedSum, $types)
6464
{
65+
$cacheTypes = [];
66+
foreach ($types as $type)
67+
{
68+
$cacheTypeMock = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
69+
->disableOriginalConstructor()
70+
->getMock();
71+
$cacheTypeMock->method('getCacheType')->willReturn($type);
72+
$cacheTypes[] = $cacheTypeMock;
73+
}
74+
6575
$this->_cacheTypeListMock->method(
6676
'getInvalidated'
6777
)->willReturn(
@@ -73,32 +83,31 @@ public function testGetIdentity($expectedSum, $cacheTypes)
7383
/**
7484
* @return array
7585
*/
76-
public function getIdentityDataProvider()
86+
public static function getIdentityDataProvider()
7787
{
78-
$cacheTypeMock1 = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
79-
->disableOriginalConstructor()
80-
->getMock();
81-
$cacheTypeMock1->method('getCacheType')->willReturn('Simple');
82-
83-
$cacheTypeMock2 = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
84-
->disableOriginalConstructor()
85-
->getMock();
86-
$cacheTypeMock2->method('getCacheType')->willReturn('Advanced');
87-
8888
return [
89-
['c13cfaddc2c53e8d32f59bfe89719beb', [$cacheTypeMock1]],
90-
['69aacdf14d1d5fcef7168b9ac308215e', [$cacheTypeMock1, $cacheTypeMock2]]
89+
['c13cfaddc2c53e8d32f59bfe89719beb', ['Simple']],
90+
['69aacdf14d1d5fcef7168b9ac308215e', ['Simple', 'Advanced']]
9191
];
9292
}
9393

9494
/**
9595
* @param bool $expected
9696
* @param bool $allowed
97-
* @param array $cacheTypes
97+
* @param array $types
9898
* @dataProvider isDisplayedDataProvider
9999
*/
100-
public function testIsDisplayed($expected, $allowed, $cacheTypes)
100+
public function testIsDisplayed($expected, $allowed, $types)
101101
{
102+
$cacheTypes = [];
103+
foreach ($types as $type)
104+
{
105+
$cacheTypeMock = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
106+
->disableOriginalConstructor()
107+
->getMock();
108+
$cacheTypeMock->method('getCacheType')->willReturn($type);
109+
$cacheTypes[] = $cacheTypeMock;
110+
}
102111
$this->_authorizationMock->expects($this->once())->method('isAllowed')->willReturn($allowed);
103112
$this->_cacheTypeListMock->method(
104113
'getInvalidated'
@@ -111,13 +120,9 @@ public function testIsDisplayed($expected, $allowed, $cacheTypes)
111120
/**
112121
* @return array
113122
*/
114-
public function isDisplayedDataProvider()
123+
public static function isDisplayedDataProvider()
115124
{
116-
$cacheTypesMock = $this->getMockBuilder(\stdClass::class)->addMethods(['getCacheType'])
117-
->disableOriginalConstructor()
118-
->getMock();
119-
$cacheTypesMock->method('getCacheType')->willReturn('someVal');
120-
$cacheTypes = [$cacheTypesMock, $cacheTypesMock];
125+
$cacheTypes = ['someVal', 'someVal'];
121126
return [
122127
[false, false, []],
123128
[false, false, $cacheTypes],

app/code/Magento/Analytics/Test/Unit/ReportXml/QueryFactoryTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ public function testCreateIfQueryNotCached(array $queryDataMock, string $jsonEnc
224224
*
225225
* @return array
226226
*/
227-
public function queryDataProvider(): array
227+
public static function queryDataProvider(): array
228228
{
229229
return [
230230
[

app/code/Magento/AsynchronousOperations/Test/Unit/Model/Entity/BulkSummaryMapperTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testEntityToDatabase($identifier, $result)
103103
/**
104104
* @return array
105105
*/
106-
public function entityToDatabaseDataProvider()
106+
public static function entityToDatabaseDataProvider()
107107
{
108108
return [
109109
[1, ['uuid' => 'bulk-1', 'id' => 1]],

app/code/Magento/AsynchronousOperations/Test/Unit/Model/OperationStatusValidatorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function testSetStatus(
7777
/**
7878
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
7979
*/
80-
public function dataProviderForTestSetStatus()
80+
public static function dataProviderForTestSetStatus()
8181
{
8282
return [
8383
[

app/code/Magento/Backend/Test/Unit/Block/Store/SwitcherTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ public function testAfterGetCurrentStoreName(array $requestedStore, string $expe
157157
*
158158
* @return array
159159
*/
160-
public function getStoreNameDataProvider(): array
160+
public static function getStoreNameDataProvider(): array
161161
{
162162
return [
163163
'test storeName with valid requested store' =>
@@ -200,7 +200,7 @@ public function testGetCurrentWebsiteName(array $requestedWebsite, string $expec
200200
*
201201
* @return array
202202
*/
203-
public function getWebsiteNameDataProvider(): array
203+
public static function getWebsiteNameDataProvider(): array
204204
{
205205
return [
206206
'test websiteName with valid requested website' =>

app/code/Magento/Backend/Test/Unit/Block/Widget/ButtonTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public function testGetAttributesHtml($data, $expect)
8686
/**
8787
* @return array
8888
*/
89-
public function getAttributesHtmlDataProvider()
89+
public static function getAttributesHtmlDataProvider()
9090
{
9191
return [
9292
[

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Filter/StoreTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function testGetCondition($expectedCondition, $value)
6262
/**
6363
* @return array
6464
*/
65-
public function getConditionDataProvider()
65+
public static function getConditionDataProvider()
6666
{
6767
return [
6868
[null, null],

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/ConcatTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ protected function setUp(): void
3232
/**
3333
* @return array
3434
*/
35-
public function typeProvider()
35+
public static function typeProvider()
3636
{
3737
return [
3838
['getGetter', ['getTest', 'getBest']],

app/code/Magento/Backend/Test/Unit/Block/Widget/Grid/Column/Renderer/Radio/ExtendedTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function testRender(array $rowData, $expectedResult)
6565
/**
6666
* @return array
6767
*/
68-
public function renderDataProvider()
68+
public static function renderDataProvider()
6969
{
7070
return [
7171
'checked' => [

0 commit comments

Comments
 (0)