Skip to content

Commit f616fd8

Browse files
committed
#27638 Fix static checks
1 parent f34f8c3 commit f616fd8

File tree

4 files changed

+29
-27
lines changed

4 files changed

+29
-27
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/Website/ReadHandlerTest.php

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,29 @@
1010
use Magento\Catalog\Model\Product;
1111
use Magento\Catalog\Model\Product\Website\ReadHandler;
1212
use Magento\Catalog\Model\ResourceModel\Product as ResourceModel;
13+
use PHPUnit\Framework\MockObject\MockObject;
1314

1415
class ReadHandlerTest extends \PHPUnit\Framework\TestCase
1516
{
16-
/** @var ResourceModel\Website\Link | \PHPUnit_Framework_MockObject_MockObject */
17-
private $websiteLink;
17+
/** @var ResourceModel\Website\Link|MockObject */
18+
private $websiteLinkMock;
1819

19-
/** @var \PHPUnit_Framework_MockObject_MockObject */
20-
private $extensionAttributes;
20+
/** @var MockObject */
21+
private $extensionAttributesMock;
2122

2223
/** @var ReadHandler */
2324
private $readHandler;
2425

2526
public function setUp()
2627
{
27-
$this->websiteLink = $this->getMockBuilder(ResourceModel\Website\Link::class)
28+
$this->websiteLinkMock = $this->getMockBuilder(ResourceModel\Website\Link::class)
2829
->disableOriginalConstructor()
2930
->getMock();
30-
$this->extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
31+
$this->extensionAttributesMock = $this->getMockBuilder(ProductExtensionInterface::class)
3132
->setMethods(['setWebsiteIds', 'getWebsiteIds'])
3233
->disableArgumentCloning()
3334
->getMockForAbstractClass();
34-
$this->readHandler = new ReadHandler($this->websiteLink);
35+
$this->readHandler = new ReadHandler($this->websiteLinkMock);
3536
}
3637

3738
public function testExecuteWithNonCachedExtensionAttributes()
@@ -44,20 +45,20 @@ public function testExecuteWithNonCachedExtensionAttributes()
4445
->method('getId')
4546
->willReturn($productId);
4647
$websiteIds = [1,2];
47-
$this->websiteLink->expects($this->once())
48+
$this->websiteLinkMock->expects($this->once())
4849
->method("getWebsiteIdsByProductId")
4950
->with($productId)
5051
->willReturn($websiteIds);
5152
$product->expects($this->exactly(2))
5253
->method('getExtensionAttributes')
53-
->willReturn($this->extensionAttributes);
54-
$this->extensionAttributes->expects($this->once())
54+
->willReturn($this->extensionAttributesMock);
55+
$this->extensionAttributesMock->expects($this->once())
5556
->method("getWebsiteIds")
5657
->willReturn(null);
5758

5859
$product->expects($this->once())
5960
->method('setExtensionAttributes')
60-
->with($this->extensionAttributes);
61+
->with($this->extensionAttributesMock);
6162

6263
$this->assertEquals($this->readHandler->execute($product, []), $product);
6364
}
@@ -68,15 +69,15 @@ public function testExecuteWithCachedWebsiteIds()
6869
->disableOriginalConstructor()
6970
->getMock();
7071
$websiteIds = [1,2];
71-
$this->extensionAttributes->expects($this->once())
72+
$this->extensionAttributesMock->expects($this->once())
7273
->method("getWebsiteIds")
7374
->willReturn($websiteIds);
7475
$product->expects($this->never())
7576
->method('setExtensionAttributes')
76-
->with($this->extensionAttributes);
77+
->with($this->extensionAttributesMock);
7778
$product->expects($this->once())
7879
->method('getExtensionAttributes')
79-
->willReturn($this->extensionAttributes);
80+
->willReturn($this->extensionAttributesMock);
8081
$this->assertEquals($this->readHandler->execute($product, []), $product);
8182
}
8283
}

app/code/Magento/Catalog/Test/Unit/Model/Product/Website/SaveHandlerTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,20 @@
1515
use Magento\Framework\Api\ExtensionAttributesInterface;
1616
use Magento\Store\Api\Data\StoreInterface;
1717
use Magento\Store\Model\StoreManagerInterface;
18+
use PHPUnit\Framework\MockObject\MockObject;
1819

1920
class SaveHandlerTest extends \PHPUnit\Framework\TestCase
2021
{
21-
/** @var ResourceModel\Website\Link | \PHPUnit_Framework_MockObject_MockObject */
22+
/** @var ResourceModel\Website\Link|MockObject */
2223
private $productWebsiteLink;
2324

24-
/** @var StoreManagerInterface | \PHPUnit_Framework_MockObject_MockObject */
25+
/** @var StoreManagerInterface|MockObject */
2526
private $storeManager;
2627

2728
/** @var SaveHandler */
2829
private $saveHandler;
2930

30-
/** @var ProductInterface | \PHPUnit_Framework_MockObject_MockObject */
31+
/** @var ProductInterface|MockObject */
3132
private $product;
3233

3334
public function setUp()

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,11 @@
4242
use Magento\Store\Api\Data\StoreInterface;
4343
use Magento\Store\Model\Store;
4444
use Magento\Store\Model\StoreManagerInterface;
45+
use PHPUnit\Framework\MockObject\MockObject;
4546
use PHPUnit\Framework\TestCase;
46-
use PHPUnit_Framework_MockObject_MockObject as MockObject;
47+
4748

4849
/**
49-
* Class ProductRepositoryTest
50-
* @package Magento\Catalog\Test\Unit\Model
5150
* @SuppressWarnings(PHPMD.TooManyFields)
5251
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
5352
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -175,7 +174,7 @@ class ProductRepositoryTest extends TestCase
175174
/**
176175
* @var ProductExtensionInterface|MockObject
177176
*/
178-
private $ProductExtensionInterface;
177+
private $productExtension;
179178

180179
/**
181180
* @var Json|MockObject

app/code/Magento/ConfigurableProduct/Test/Unit/Model/LinkManagementTest.php

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@
88

99
use Magento\ConfigurableProduct\Model\LinkManagement;
1010
use Magento\ConfigurableProduct\Model\Product\Type\Configurable;
11+
use PHPUnit\Framework\MockObject\MockObject;
1112

1213
/**
1314
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1415
*/
1516
class LinkManagementTest extends \PHPUnit\Framework\TestCase
1617
{
1718
/**
18-
* @var \PHPUnit_Framework_MockObject_MockObject
19+
* @var MockObject
1920
*/
2021
protected $productRepository;
2122

2223
/**
23-
* @var \PHPUnit_Framework_MockObject_MockObject
24+
* @var MockObject
2425
*/
2526
protected $productFactory;
2627

@@ -30,7 +31,7 @@ class LinkManagementTest extends \PHPUnit\Framework\TestCase
3031
protected $objectManagerHelper;
3132

3233
/**
33-
* @var \PHPUnit_Framework_MockObject_MockObject
34+
* @var MockObject
3435
*/
3536
protected $configurableType;
3637

@@ -40,7 +41,7 @@ class LinkManagementTest extends \PHPUnit\Framework\TestCase
4041
protected $object;
4142

4243
/**
43-
* @var \PHPUnit_Framework_MockObject_MockObject|\Magento\Framework\Api\DataObjectHelper
44+
* @var MockObject|\Magento\Framework\Api\DataObjectHelper
4445
*/
4546
protected $dataObjectHelperMock;
4647

@@ -159,10 +160,10 @@ public function testAddChild()
159160
]
160161
)
161162
->getMockForAbstractClass();
162-
$optionMock = $this->getMockBuilder(\Magento\ConfigurableProduct\Api\Data\Option::class)
163+
$optionMock = $this->getMockBuilder(\Magento\ConfigurableProduct\Api\Data\OptionInterface::class)
163164
->disableOriginalConstructor()
164165
->setMethods(['getProductAttribute', 'getPosition', 'getAttributeId'])
165-
->getMock();
166+
->getMockForAbstractClass();
166167
$productAttributeMock = $this->getMockBuilder(\Magento\Eav\Model\Entity\Attribute\AbstractAttribute::class)
167168
->disableOriginalConstructor()
168169
->setMethods(['getAttributeCode'])

0 commit comments

Comments
 (0)