Skip to content

Commit 2c71908

Browse files
committed
Fix phpmd issues that were false-positive
1 parent 8273de6 commit 2c71908

File tree

18 files changed

+28
-19
lines changed

18 files changed

+28
-19
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ public function testRecreateWithExpression(
198198
->willReturn($this->selectMock);
199199
$withArgs = [];
200200

201-
foreach (array_keys($selectParts) as $key => $partName) {
201+
foreach (array_keys($selectParts) as $partName) {
202202
$withArgs[] = [$partName, $expectedParts[$partName]];
203203
}
204204
$this->selectMock

app/code/Magento/Backend/Test/Unit/Controller/Adminhtml/System/Account/SaveTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,10 +195,7 @@ protected function setUp(): void
195195
$args = ['context' => $contextMock];
196196

197197
$testHelper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
198-
$this->controller = $testHelper->getObject(
199-
Save::class,
200-
$args
201-
);
198+
$this->controller = $testHelper->getObject(Save::class, $args);
202199
}
203200

204201
/**

app/code/Magento/Bundle/Test/Unit/Model/Product/TypeTest.php

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1383,8 +1383,7 @@ public function testPrepareForCartAdvancedAllRequiredOption(): void
13831383
'getBundleOption',
13841384
'getBundleOptionsData'
13851385
]
1386-
)
1387-
->disableOriginalConstructor()
1386+
)->disableOriginalConstructor()
13881387
->getMock();
13891388
/* @var \PHPUnit\Framework\MockObject\MockObject|\Magento\Catalog\Model\Product\Option $option */
13901389
$option = $this->getMockBuilder(Option::class)
@@ -1405,8 +1404,7 @@ public function testPrepareForCartAdvancedAllRequiredOption(): void
14051404
'hasData',
14061405
'getData'
14071406
]
1408-
)
1409-
->addMethods(['getHasOptions', 'setCartQty', 'getSkipCheckRequiredOption'])
1407+
)->addMethods(['getHasOptions', 'setCartQty', 'getSkipCheckRequiredOption'])
14101408
->disableOriginalConstructor()
14111409
->getMock();
14121410
/** @var MockObject|Type $productType */
@@ -1419,7 +1417,6 @@ public function testPrepareForCartAdvancedAllRequiredOption(): void
14191417
->onlyMethods(['getItems'])
14201418
->disableOriginalConstructor()
14211419
->getMock();
1422-
14231420
$this->parentClass($group, $option, $buyRequest, $product);
14241421

14251422
$product->expects($this->any())
@@ -1444,7 +1441,6 @@ function ($key) use ($optionCollection) {
14441441
$resultValue = [0 => 5];
14451442
break;
14461443
}
1447-
14481444
return $resultValue;
14491445
}
14501446
);
@@ -1456,8 +1452,7 @@ function ($key) use ($optionCollection) {
14561452
$buyRequest->expects($this->once())
14571453
->method('getBundleOption')
14581454
->willReturn([3 => 5]);
1459-
$option
1460-
->method('getId')
1455+
$option->method('getId')
14611456
->willReturnOnConsecutiveCalls(3);
14621457
$option->expects($this->once())
14631458
->method('getRequired')

app/code/Magento/CacheInvalidate/Test/Unit/Model/PurgeCacheTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ public function testSendPurgeRequest(array $hosts): void
9191
$connectWithArgs = $writeWithArgs = [];
9292

9393
foreach ($uris as $uri) {
94-
$withArgs[] = [$uri->getHost(), $uri->getPort()];
9594
$writeWithArgs[] = ['PURGE', $uri, '1.1', ['X-Magento-Tags-Pattern' => 'tags', 'Host' => $uri->getHost()]];
9695
}
9796
$this->socketAdapterMock

app/code/Magento/Catalog/Test/Unit/Model/ProductRepositoryTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,6 @@ public function testGetByIdProductInEditMode(): void
551551
*/
552552
public function testGetByIdForCacheKeyGenerate($identifier, $editMode, $storeId): void
553553
{
554-
$callIndex = 0;
555554
$this->productFactory
556555
->expects($this->once())
557556
->method('create')

app/code/Magento/Catalog/Test/Unit/Pricing/Render/FinalPriceBoxTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,8 @@ protected function setUp(): void
113113

114114
$eventManager = $this->createMock(ManagerStub::class);
115115
$this->layout = $this->createMock(Layout::class);
116-
117116
$this->priceBox = $this->createMock(PriceBox::class);
118117
$this->logger = $this->getMockForAbstractClass(LoggerInterface::class);
119-
120118
$this->layout->expects($this->any())->method('getBlock')->willReturn($this->priceBox);
121119

122120
$cacheState = $this->getMockBuilder(StateInterface::class)

app/code/Magento/Customer/Test/Unit/Controller/Account/ConfirmTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ public function getParametersDataProvider(): array
275275
*
276276
* @return void
277277
* @dataProvider getSuccessMessageDataProvider
278+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
278279
*/
279280
public function testSuccessMessage(
280281
$customerId,

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,6 +1510,7 @@ public function testSendPasswordReminderEmail(): void
15101510
* @param string $hash
15111511
*
15121512
* @return void
1513+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
15131514
*/
15141515
protected function prepareInitiatePasswordReset(
15151516
$email,

app/code/Magento/Customer/Test/Unit/Model/Plugin/SaveCustomerGroupExcludedWebsiteTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
use PHPUnit\Framework\MockObject\MockObject;
2424
use PHPUnit\Framework\TestCase;
2525

26+
/**
27+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28+
*/
2629
class SaveCustomerGroupExcludedWebsiteTest extends TestCase
2730
{
2831
/**

app/code/Magento/Elasticsearch/Test/Unit/Model/Adapter/ElasticsearchTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ class ElasticsearchTest extends TestCase
104104

105105
/**
106106
* @inheritdoc
107+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
107108
*/
108109
protected function setUp(): void
109110
{

app/code/Magento/Email/Test/Unit/Model/Template/Config/FileIteratorTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ public function testIterator(): void
8282
'<template module="' . $moduleName . '" 321>'
8383
];
8484
$index = 0;
85-
$dirIndex = 0;
8685

8786
$moduleDirResolverWithArgs = $moduleDirResolverWillReturnArgs = [];
8887
$fileReadFactoryWithArgs = $fileReadFactoryWillReturnArgs = [];

app/code/Magento/Reports/Test/Unit/Helper/DataTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ public function testPrepareIntervalsCollection($from, $to, $period, $results): v
100100

101101
$withArgs = [];
102102

103-
foreach ($results as $key => $result) {
103+
foreach ($results as $result) {
104104
$withArgs[] = [$result];
105105
}
106106
$item

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/Create/ConfigureProductToAddTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
/**
2828
* Tests for \Magento\Sales\Controller\Adminhtml\Order\Create\ConfigureProductToAdd
29+
*
30+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2931
*/
3032
class ConfigureProductToAddTest extends TestCase
3133
{

app/code/Magento/Sales/Test/Unit/Model/EmailSenderHandlerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
/**
2828
* Unit test of sales emails sending observer.
29+
*
30+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2931
*/
3032
class EmailSenderHandlerTest extends TestCase
3133
{
@@ -152,6 +154,7 @@ protected function setUp(): void
152154
*
153155
* @return void
154156
* @dataProvider executeDataProvider
157+
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
155158
*/
156159
public function testExecute(
157160
int $configValue,

dev/tests/integration/framework/Magento/TestFramework/Annotation/IndexerDimensionMode.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
/**
2323
* Implementation of the @magentoIndexerDimensionMode DocBlock annotation
24+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
2425
*/
2526
class IndexerDimensionMode
2627
{

dev/tests/integration/framework/tests/unit/testsuite/Magento/Test/ApplicationTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323

2424
/**
2525
* Provides tests for \Magento\TestFramework\Application.
26+
*
27+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
28+
*
2629
*/
2730
class ApplicationTest extends \PHPUnit\Framework\TestCase
2831
{

dev/tests/static/framework/tests/unit/testsuite/Magento/TestFramework/Integrity/Library/_files/DummyInjectableClass.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
use Magento\Framework\DataObject;
1111
use TestNamespace\Some\SomeTestClass;
1212

13+
/**
14+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
15+
* @SuppressWarnings(PHPMD.UnusedPrivateMethod)
16+
*/
1317
class DummyInjectableClass
1418
{
1519
public function testMethod(DataObject $dataObject, SomeTestClass $test)

lib/internal/Magento/Framework/Mview/Test/Unit/View/SubscriptionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424
use ReflectionException;
2525
use ReflectionMethod;
2626

27+
/**
28+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
29+
*/
2730
class SubscriptionTest extends TestCase
2831
{
2932
/**

0 commit comments

Comments
 (0)