Skip to content

Commit 198c76f

Browse files
committed
MC-40561: Stabilize unit tests
1 parent 2774fbf commit 198c76f

File tree

17 files changed

+72
-36
lines changed

17 files changed

+72
-36
lines changed

app/code/Magento/BundleImportExport/Test/Unit/Model/Import/Product/Type/BundleTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Magento\BundleImportExport\Test\Unit\Model\Import\Product\Type;
88

99
/**
10-
* Class BundleTest
10+
* Tests for Bundle
1111
*
1212
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
1313
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)

app/code/Magento/Catalog/Model/Product/TierPriceManagement.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,10 @@ public function __construct(
9090
*/
9191
public function add($sku, $customerGroupId, $price, $qty)
9292
{
93-
if (!\Zend_Validate::is((string)$price, 'Float') || $price <= 0 || !\Zend_Validate::is((string)$qty, 'Float') || $qty <= 0) {
93+
if (!\Zend_Validate::is((string)$price, 'Float')
94+
|| $price <= 0 || !\Zend_Validate::is((string)$qty, 'Float')
95+
|| $qty <= 0
96+
) {
9497
throw new InputException(__('The data was invalid. Verify the data and try again.'));
9598
}
9699
$product = $this->productRepository->get($sku, ['edit_mode' => true]);

app/code/Magento/Catalog/Test/Unit/Model/ProductLink/RepositoryTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,9 @@ public function testDeleteWithInvalidDataException()
251251
public function testDeleteWithNoSuchEntityException()
252252
{
253253
$this->expectException(\Magento\Framework\Exception\NoSuchEntityException::class);
254-
$this->expectExceptionMessage('Product with SKU \'linkedProduct\' is not linked to product with SKU \'product\'');
254+
$this->expectExceptionMessage(
255+
'Product with SKU \'linkedProduct\' is not linked to product with SKU \'product\''
256+
);
255257

256258
$entityMock = $this->createMock(\Magento\Catalog\Model\ProductLink\Link::class);
257259
$productMock = $this->createMock(\Magento\Catalog\Model\Product::class);

app/code/Magento/Checkout/Model/Sidebar.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
use Magento\Quote\Model\Quote\Address\Total;
1414

1515
/**
16+
* Data model for the sidebar
17+
*
1618
* @deprecated 100.1.0
1719
*/
1820
class Sidebar

app/code/Magento/Customer/Test/Unit/Model/ResourceModel/AddressTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
namespace Magento\Customer\Test\Unit\Model\ResourceModel;
88

9+
use Magento\Customer\Model\Address;
910
use Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite;
1011
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot;
1112
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
@@ -261,7 +262,6 @@ public function testGetType()
261262
/**
262263
* Class SubResourceModelAddress
263264
* Mock method getAttributeLoader
264-
* @package Magento\Customer\Test\Unit\Model\ResourceModel
265265
* @codingStandardsIgnoreStart
266266
*/
267267
class SubResourceModelAddress extends \Magento\Customer\Model\ResourceModel\Address

app/code/Magento/Indexer/Test/Unit/Console/Command/IndexerReindexCommandTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,10 @@ public function testExecuteAll()
9797
$this->configMock->expects($this->once())
9898
->method('getIndexer')
9999
->willReturn(
100-
101100
[
102101
'title' => 'Title_indexerOne',
103102
'shared_index' => null
104103
]
105-
106104
);
107105
$this->configureAdminArea();
108106
$this->initIndexerCollectionByItems(
@@ -139,8 +137,7 @@ public function testExecuteWithIndex(
139137
array $reindexAllCallMatchers,
140138
array $executedIndexers,
141139
array $executedSharedIndexers
142-
)
143-
{
140+
) {
144141
$this->addSeparateIndexersToConfigMock($indexers);
145142
$this->addAllIndexersToConfigMock($indexers);
146143

app/code/Magento/Integration/Test/Unit/Controller/Token/AccessTest.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,12 @@ protected function setUp(): void
116116

117117
$this->helperMock = $this->createMock(\Magento\Framework\Oauth\Helper\Request::class);
118118
$this->frameworkOauthSvcMock = $this->getMockForAbstractClass(\Magento\Framework\Oauth\OauthInterface::class);
119-
$this->intOauthServiceMock = $this->getMockForAbstractClass(\Magento\Integration\Api\OauthServiceInterface::class);
120-
$this->integrationServiceMock = $this->getMockForAbstractClass(\Magento\Integration\Api\IntegrationServiceInterface::class);
119+
$this->intOauthServiceMock = $this->getMockForAbstractClass(
120+
\Magento\Integration\Api\OauthServiceInterface::class
121+
);
122+
$this->integrationServiceMock = $this->getMockForAbstractClass(
123+
\Magento\Integration\Api\IntegrationServiceInterface::class
124+
);
121125
/** @var \Magento\Framework\TestFramework\Unit\Helper\ObjectManager $objectManagerHelper */
122126
$this->objectManagerHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
123127
$this->accessAction = $this->objectManagerHelper->getObject(

app/code/Magento/SalesRule/Test/Unit/Model/Coupon/MassgeneratorTest.php

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace Magento\SalesRule\Test\Unit\Model\Coupon;
77

88
/**
9-
* Class MassgeneratorTest
9+
* Tests for Massgenerator
1010
*/
1111
class MassgeneratorTest extends \PHPUnit\Framework\TestCase
1212
{
@@ -36,7 +36,9 @@ protected function setUp(): void
3636
*/
3737
public function testGenerateCode(array $data, $length)
3838
{
39-
$salesRuleCouponMock = $this->createPartialMock(\Magento\SalesRule\Helper\Coupon::class, ['getCharset', 'getCodeSeparator']);
39+
$salesRuleCouponMock = $this->createPartialMock(
40+
\Magento\SalesRule\Helper\Coupon::class, ['getCharset', 'getCodeSeparator']
41+
);
4042

4143
/** @var \Magento\SalesRule\Model\Coupon\Massgenerator $massgenerator */
4244
$massgenerator = $this->objectManager->getObject(
@@ -160,7 +162,9 @@ public function testGeneratePool()
160162
public function testGeneratePoolException()
161163
{
162164
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
163-
$this->expectExceptionMessage('We cannot create the requested Coupon Qty. Please check your settings and try again.');
165+
$this->expectExceptionMessage(
166+
'We cannot create the requested Coupon Qty. Please check your settings and try again.'
167+
);
164168

165169
$data = [
166170
'qty' => 3,
@@ -169,7 +173,9 @@ public function testGeneratePoolException()
169173
'max_attempts' => 0,
170174
];
171175

172-
$salesRuleCouponMock = $this->createPartialMock(\Magento\SalesRule\Helper\Coupon::class, ['getCharset', 'getCodeSeparator']);
176+
$salesRuleCouponMock = $this->createPartialMock(
177+
\Magento\SalesRule\Helper\Coupon::class, ['getCharset', 'getCodeSeparator']
178+
);
173179
$resourceMock = $this->createPartialMock(
174180
\Magento\SalesRule\Model\ResourceModel\Coupon::class,
175181
['exists', '__wakeup', 'getIdFieldName']

app/code/Magento/User/Observer/Backend/AuthObserver.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020

2121
/**
2222
* User backend observer model for authentication
23+
*
2324
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
25+
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
2426
*/
2527
class AuthObserver implements ObserverInterface
2628
{

lib/internal/Magento/Framework/App/Route/Config.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99

1010
use Magento\Framework\Serialize\SerializerInterface;
1111

12+
/**
13+
* Config holds the configuration of a route
14+
*/
1215
class Config implements ConfigInterface
1316
{
1417
/**
@@ -101,7 +104,7 @@ protected function _getRoutes($scope = null)
101104
* Retrieve route front name
102105
*
103106
* @param string $routeId
104-
* @param null $scope
107+
* @param string $scope
105108
* @return string
106109
*/
107110
public function getRouteFrontName($routeId, $scope = null)
@@ -111,6 +114,8 @@ public function getRouteFrontName($routeId, $scope = null)
111114
}
112115

113116
/**
117+
* Retrieve route ID by front name
118+
*
114119
* @param string $frontName
115120
* @param string $scope
116121
* @return bool|int|string
@@ -127,6 +132,8 @@ public function getRouteByFrontName($frontName, $scope = null)
127132
}
128133

129134
/**
135+
* Retrieve modules by front name
136+
*
130137
* @param string $frontName
131138
* @param string $scope
132139
* @return string[]

0 commit comments

Comments
 (0)