Skip to content

Commit 9ad86c3

Browse files
committed
MC-33706: Merge 2.4-develop into 2.4-develop-php74
1 parent c557d71 commit 9ad86c3

File tree

28 files changed

+1047
-462
lines changed

28 files changed

+1047
-462
lines changed

app/code/Magento/Catalog/Test/Unit/Model/Product/CopierTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
namespace Magento\Catalog\Test\Unit\Model\Product;
88

9-
use Magento\Catalog\Api\Data\ProductExtension;
9+
use Magento\Catalog\Api\Data\ProductExtensionInterface;
1010
use Magento\Catalog\Api\Data\ProductInterface;
1111
use Magento\Catalog\Model\Attribute\ScopeOverriddenValue;
1212
use Magento\Catalog\Model\Product;
@@ -106,9 +106,9 @@ protected function setUp(): void
106106
public function testCopy(): void
107107
{
108108
$stockItem = $this->getMockForAbstractClass(StockItemInterface::class);
109-
$extensionAttributes = $this->getMockBuilder(ProductExtension::class)
109+
$extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
110110
->setMethods(['getStockItem', 'setData'])
111-
->getMock();
111+
->getMockForAbstractClass();
112112
$extensionAttributes
113113
->expects($this->once())
114114
->method('getStockItem')
@@ -262,9 +262,9 @@ public function testUrlAlreadyExistsExceptionWhileCopyStoresUrl(): void
262262
{
263263
$stockItem = $this->getMockBuilder(StockItemInterface::class)
264264
->getMock();
265-
$extensionAttributes = $this->getMockBuilder(ProductExtension::class)
265+
$extensionAttributes = $this->getMockBuilder(ProductExtensionInterface::class)
266266
->setMethods(['getStockItem', 'setData'])
267-
->getMock();
267+
->getMockForAbstractClass();
268268
$extensionAttributes
269269
->expects($this->once())
270270
->method('getStockItem')

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

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,33 @@
66

77
namespace Magento\Catalog\Test\Unit\Model\Product\Website;
88

9-
use Magento\Catalog\Api\Data\ProductExtension;
9+
use Magento\Catalog\Api\Data\ProductExtensionInterface;
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
protected function setUp(): void
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(ProductExtension::class)
31+
$this->extensionAttributesMock = $this->getMockBuilder(ProductExtensionInterface::class)
3132
->setMethods(['setWebsiteIds', 'getWebsiteIds'])
3233
->disableArgumentCloning()
33-
->getMock();
34-
$this->readHandler = new ReadHandler($this->websiteLink);
34+
->getMockForAbstractClass();
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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,27 @@
66

77
namespace Magento\Catalog\Test\Unit\Model\Product\Website;
88

9-
use Magento\Catalog\Api\Data\ProductExtension;
109
use Magento\Catalog\Api\Data\ProductInterface;
1110
use Magento\Catalog\Model\ResourceModel\Product\Website\Link;
1211
use Magento\Catalog\Model\Product\Website\SaveHandler;
13-
use Magento\Catalog\Model\Product;
1412
use Magento\Catalog\Model\ResourceModel\Product as ResourceModel;
1513
use Magento\Framework\Api\ExtensionAttributesInterface;
1614
use Magento\Store\Api\Data\StoreInterface;
1715
use Magento\Store\Model\StoreManagerInterface;
16+
use PHPUnit\Framework\MockObject\MockObject;
1817

1918
class SaveHandlerTest extends \PHPUnit\Framework\TestCase
2019
{
21-
/** @var ResourceModel\Website\Link | \PHPUnit\Framework\MockObject\MockObject */
20+
/** @var ResourceModel\Website\Link|MockObject */
2221
private $productWebsiteLink;
2322

24-
/** @var StoreManagerInterface | \PHPUnit\Framework\MockObject\MockObject */
23+
/** @var StoreManagerInterface|MockObject */
2524
private $storeManager;
2625

2726
/** @var SaveHandler */
2827
private $saveHandler;
2928

30-
/** @var ProductInterface | \PHPUnit\Framework\MockObject\MockObject */
29+
/** @var ProductInterface|MockObject */
3130
private $product;
3231

3332
protected function setUp(): void

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@
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;
4747

4848
/**
49-
* Class ProductRepositoryTest
50-
* @package Magento\Catalog\Test\Unit\Model
5149
* @SuppressWarnings(PHPMD.TooManyFields)
5250
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
5351
* @SuppressWarnings(PHPMD.ExcessiveMethodLength)
@@ -304,11 +302,11 @@ protected function setUp(): void
304302
$this->serializerMock->expects($this->any())
305303
->method('unserialize')
306304
->willReturnCallback(
307-
305+
308306
function ($value) {
309307
return json_decode($value, true);
310308
}
311-
309+
312310
);
313311

314312
$mediaProcessor = $this->objectManager->getObject(

app/code/Magento/Catalog/Test/Unit/Ui/Component/Product/MassActionTest.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@
1111
use Magento\Framework\AuthorizationInterface;
1212
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
1313
use Magento\Framework\View\Element\UiComponent\ContextInterface;
14+
use PHPUnit\Framework\MockObject\MockObject;
1415

1516
/**
16-
* MassAction test
17+
* MassAction test for Component Product
1718
*/
1819
class MassActionTest extends \PHPUnit\Framework\TestCase
1920
{
2021
/**
21-
* @var ContextInterface|\PHPUnit\Framework\MockObject\MockObject
22+
* @var ContextInterface|MockObject
2223
*/
2324
private $contextMock;
2425

@@ -28,7 +29,7 @@ class MassActionTest extends \PHPUnit\Framework\TestCase
2829
private $objectManager;
2930

3031
/**
31-
* @var AuthorizationInterface|\PHPUnit\Framework\MockObject\MockObject
32+
* @var AuthorizationInterface|MockObject
3233
*/
3334
private $authorizationMock;
3435

@@ -107,7 +108,6 @@ public function getPrepareDataProvider() : array
107108
'type' => 'first_action',
108109
'label' => 'First Action',
109110
'url' => '/module/controller/firstAction',
110-
'__disableTmpl' => true
111111
],
112112
],
113113
[
@@ -127,7 +127,6 @@ public function getPrepareDataProvider() : array
127127
'url' => '/module/controller/secondSubAction2'
128128
],
129129
],
130-
'__disableTmpl' => true
131130
],
132131
],
133132
[
@@ -147,7 +146,6 @@ public function getPrepareDataProvider() : array
147146
'url' => '/module/controller/disable'
148147
],
149148
],
150-
'__disableTmpl' => true
151149
],
152150
],
153151
[
@@ -167,7 +165,6 @@ public function getPrepareDataProvider() : array
167165
'url' => '/module/controller/disable'
168166
],
169167
],
170-
'__disableTmpl' => true
171168
],
172169
false,
173170
false
@@ -178,7 +175,6 @@ public function getPrepareDataProvider() : array
178175
'type' => 'delete',
179176
'label' => 'First Action',
180177
'url' => '/module/controller/delete',
181-
'__disableTmpl' => true
182178
],
183179
],
184180
[
@@ -187,7 +183,6 @@ public function getPrepareDataProvider() : array
187183
'type' => 'delete',
188184
'label' => 'First Action',
189185
'url' => '/module/controller/delete',
190-
'__disableTmpl' => true
191186
],
192187
false,
193188
false
@@ -198,7 +193,6 @@ public function getPrepareDataProvider() : array
198193
'type' => 'delete',
199194
'label' => 'First Action',
200195
'url' => '/module/controller/attributes',
201-
'__disableTmpl' => true
202196
],
203197
],
204198
[
@@ -207,7 +201,6 @@ public function getPrepareDataProvider() : array
207201
'type' => 'delete',
208202
'label' => 'First Action',
209203
'url' => '/module/controller/attributes',
210-
'__disableTmpl' => true
211204
],
212205
false,
213206
false

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/BlockActionsTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
use Magento\Framework\UrlInterface;
1212
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1313
use Magento\Framework\View\Element\UiComponent\Processor;
14-
use PHPUnit\Framework\MockObject\MockObject as MockObject;
14+
use PHPUnit\Framework\MockObject\MockObject;
1515

1616
/**
1717
* BlockActionsTest contains unit tests for \Magento\Cms\Ui\Component\Listing\Column\BlockActions class.
@@ -96,7 +96,6 @@ public function testPrepareDataSource()
9696
'edit' => [
9797
'href' => 'test/url/edit',
9898
'label' => __('Edit'),
99-
'__disableTmpl' => true,
10099
],
101100
'delete' => [
102101
'href' => 'test/url/delete',
@@ -106,7 +105,6 @@ public function testPrepareDataSource()
106105
'message' => __('Are you sure you want to delete a %1 record?', $title),
107106
],
108107
'post' => true,
109-
'__disableTmpl' => true,
110108
],
111109
],
112110
],

app/code/Magento/Cms/Test/Unit/Ui/Component/Listing/Column/PageActionsTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\View\Element\UiComponent\ContextInterface;
1616
use Magento\Framework\View\Element\UiComponent\Processor;
1717
use PHPUnit\Framework\TestCase;
18-
use PHPUnit\Framework\MockObject\MockObject as MockObject;
18+
use PHPUnit\Framework\MockObject\MockObject;
1919

2020
/**
2121
* Test for Magento\Cms\Ui\Component\Listing\Column\PageActions class.
@@ -176,23 +176,19 @@ public function configDataProvider():array
176176
'edit' => [
177177
'href' => 'test/url/edit',
178178
'label' => __('Edit'),
179-
'__disableTmpl' => true,
180179
],
181180
'delete' => [
182181
'href' => 'test/url/delete',
183182
'label' => __('Delete'),
184183
'confirm' => [
185184
'title' => __('Delete %1', $title),
186185
'message' => __('Are you sure you want to delete a %1 record?', $title),
187-
'__disableTmpl' => true,
188186
],
189187
'post' => true,
190-
'__disableTmpl' => true,
191188
],
192189
'preview' => [
193190
'href' => 'test/url/view',
194191
'label' => __('View'),
195-
'__disableTmpl' => true,
196192
'target' => '_blank'
197193
]
198194
],

app/code/Magento/Config/Test/Unit/Model/Config/Source/Email/TemplateTest.php

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Config\Test\Unit\Model\Config\Source\Email;
88

9+
use PHPUnit\Framework\MockObject\MockObject;
10+
911
/**
1012
* Test class for Template.
1113
*/
@@ -17,12 +19,12 @@ class TemplateTest extends \PHPUnit\Framework\TestCase
1719
protected $_model;
1820

1921
/**
20-
* @var \Magento\Framework\Registry|\PHPUnit\Framework\MockObject\MockObject
22+
* @var \Magento\Framework\Registry|MockObject
2123
*/
2224
protected $_coreRegistry;
2325

2426
/**
25-
* @var \Magento\Email\Model\Template\Config|\PHPUnit\Framework\MockObject\MockObject
27+
* @var \Magento\Email\Model\Template\Config|MockObject
2628
*/
2729
protected $_emailConfig;
2830

@@ -53,12 +55,10 @@ public function testToOptionArray()
5355
)->method(
5456
'toOptionArray'
5557
)->willReturn(
56-
57-
[
58+
[
5859
['value' => 'template_one', 'label' => 'Template One'],
5960
['value' => 'template_two', 'label' => 'Template Two'],
6061
]
61-
6262
);
6363
$this->_coreRegistry->expects(
6464
$this->once()
@@ -82,17 +82,14 @@ public function testToOptionArray()
8282
[
8383
'value' => 'template_new',
8484
'label' => 'Template New (Default)',
85-
'__disableTmpl' => true
8685
],
8786
[
8887
'value' => 'template_one',
8988
'label' => 'Template One',
90-
'__disableTmpl' => true
9189
],
9290
[
9391
'value' => 'template_two',
9492
'label' => 'Template Two',
95-
'__disableTmpl' => true
9693
],
9794
];
9895
$this->_model->setPath('template/new');

0 commit comments

Comments
 (0)