Skip to content

Commit 90bacac

Browse files
authored
Merge pull request #6610 from magento-lynx/MC-39900
[MC-39900] Stabilize unit tests
2 parents 50b3b95 + 9557fa6 commit 90bacac

File tree

33 files changed

+78
-98
lines changed

33 files changed

+78
-98
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
@@ -13,7 +13,7 @@
1313
use Magento\Framework\App\CacheInterface;
1414

1515
/**
16-
* Class CanViewNotificationTest
16+
* Test of CanViewNotification
1717
*/
1818
class CanViewNotificationTest extends \PHPUnit\Framework\TestCase
1919
{

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use \Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
1010

1111
/**
12-
* Class TierPriceTypeTest.
12+
* Test of TierPriceType.
1313
*/
1414
class TierPriceTypeTest extends \PHPUnit\Framework\TestCase
1515
{

app/code/Magento/AdvancedSearch/Test/Unit/Controller/Adminhtml/Search/System/Config/TestConnectionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\AdvancedSearch\Model\Client\ClientInterface;
1111

1212
/**
13-
* Class TestConnectionTest
13+
* Test of TestConnection
1414
*
1515
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1616
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public function testExecute()
7474
->with(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE)
7575
->willReturn($attemptsCount);
7676

77-
$attemptsCount -= 1;
77+
--$attemptsCount;
7878
$this->flagManagerMock->expects($this->once())
7979
->method('saveFlag')
8080
->with(SubscriptionHandler::ATTEMPTS_REVERSE_COUNTER_FLAG_CODE, $attemptsCount);

app/code/Magento/Analytics/Test/Unit/Model/ReportXml/ModuleIteratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
1212

1313
/**
14-
* Module iterator test.
14+
* Test for ModuleIterator.
1515
*/
1616
class ModuleIteratorTest extends \PHPUnit\Framework\TestCase
1717
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
use Magento\AsynchronousOperations\Model\Entity\BulkSummaryMapper;
1010

1111
/**
12-
* Class BulkSummaryMapperTest
12+
* Test for BulkSummaryMapper
1313
*/
1414
class BulkSummaryMapperTest extends \PHPUnit\Framework\TestCase
1515
{
@@ -91,7 +91,7 @@ public function testEntityToDatabase($identifier, $result)
9191
->method('fetchOne')
9292
->with($this->selectMock)
9393
->willReturn($identifier);
94-
94+
9595
$this->assertEquals($result, $this->model->entityToDatabase($entityType, $data));
9696
}
9797

app/code/Magento/AsynchronousOperations/Test/Unit/Model/ResourceModel/System/Message/Collection/Synchronized/PluginTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
use Magento\AdminNotification\Model\ResourceModel\System\Message\Collection\Synchronized;
1515

1616
/**
17-
* Class PluginTest
17+
* Test for Plugin
1818
*
1919
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2020
*/

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
use Magento\Framework\Bulk\BulkSummaryInterface;
1111

1212
/**
13-
* Class StatusMapperTest
13+
* Test for StatusMapper
1414
*/
1515
class StatusMapperTest extends \PHPUnit\Framework\TestCase
1616
{

app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RoleTest.php

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -73,21 +73,17 @@ protected function setUp(): void
7373
$this->serializerMock->expects($this->any())
7474
->method('serialize')
7575
->willReturnCallback(
76-
77-
function ($value) {
78-
return json_encode($value);
79-
}
80-
76+
function ($value) {
77+
return json_encode($value);
78+
}
8179
);
8280

8381
$this->serializerMock->expects($this->any())
8482
->method('unserialize')
8583
->willReturnCallback(
86-
87-
function ($value) {
88-
return json_decode($value, true);
89-
}
90-
84+
function ($value) {
85+
return json_decode($value, true);
86+
}
9187
);
9288

9389
$this->aclDataCacheMock = $this->createMock(\Magento\Framework\Acl\Data\CacheInterface::class);
@@ -119,12 +115,10 @@ public function testPopulateAclAddsRolesAndTheirChildren()
119115
$this->_adapterMock->expects($this->once())
120116
->method('fetchAll')
121117
->willReturn(
122-
123-
[
124-
['role_id' => 1, 'role_type' => 'G', 'parent_id' => null],
125-
['role_id' => 2, 'role_type' => 'U', 'parent_id' => 1, 'user_id' => 1],
126-
]
127-
118+
[
119+
['role_id' => 1, 'role_type' => 'G', 'parent_id' => null],
120+
['role_id' => 2, 'role_type' => 'U', 'parent_id' => 1, 'user_id' => 1],
121+
]
128122
);
129123

130124
$this->_groupFactoryMock->expects($this->once())->method('create')->with(['roleId' => '1']);
@@ -175,18 +169,16 @@ public function testPopulateAclFromCache()
175169
->method('load')
176170
->with(\Magento\Authorization\Model\Acl\Loader\Role::ACL_ROLES_CACHE_KEY)
177171
->willReturn(
178-
179-
json_encode(
172+
json_encode(
173+
[
180174
[
181-
[
182-
'role_id' => 1,
183-
'role_type' => 'U',
184-
'parent_id' => 2,
185-
'user_id' => 3
186-
]
175+
'role_id' => 1,
176+
'role_type' => 'U',
177+
'parent_id' => 2,
178+
'user_id' => 3
187179
]
188-
)
189-
180+
]
181+
)
190182
);
191183

192184
$this->_roleFactoryMock->expects($this->never())->method('getModelInstance');

app/code/Magento/Authorization/Test/Unit/Model/Acl/Loader/RuleTest.php

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,17 @@ protected function setUp(): void
4545
$this->serializerMock->expects($this->any())
4646
->method('serialize')
4747
->willReturnCallback(
48-
49-
function ($value) {
50-
return json_encode($value);
51-
}
52-
48+
function ($value) {
49+
return json_encode($value);
50+
}
5351
);
5452

5553
$this->serializerMock->expects($this->any())
5654
->method('unserialize')
5755
->willReturnCallback(
58-
59-
function ($value) {
60-
return json_decode($value, true);
61-
}
62-
56+
function ($value) {
57+
return json_decode($value, true);
58+
}
6359
);
6460

6561
$this->aclDataCacheMock = $this->createMock(\Magento\Framework\Acl\Data\CacheInterface::class);
@@ -84,15 +80,13 @@ public function testPopulateAclFromCache()
8480
->method('load')
8581
->with(\Magento\Authorization\Model\Acl\Loader\Rule::ACL_RULE_CACHE_KEY)
8682
->willReturn(
87-
88-
json_encode(
89-
[
90-
['role_id' => 1, 'resource_id' => 'Magento_Backend::all', 'permission' => 'allow'],
91-
['role_id' => 2, 'resource_id' => 1, 'permission' => 'allow'],
92-
['role_id' => 3, 'resource_id' => 1, 'permission' => 'deny'],
93-
]
94-
)
95-
83+
json_encode(
84+
[
85+
['role_id' => 1, 'resource_id' => 'Magento_Backend::all', 'permission' => 'allow'],
86+
['role_id' => 2, 'resource_id' => 1, 'permission' => 'allow'],
87+
['role_id' => 3, 'resource_id' => 1, 'permission' => 'deny'],
88+
]
89+
)
9690
);
9791

9892
$aclMock = $this->createMock(\Magento\Framework\Acl::class);

0 commit comments

Comments
 (0)