Skip to content

Commit 4cf2d07

Browse files
committed
Merge remote-tracking branch 'origin/AC-10634-ce' into AC-10821
2 parents 25beb0a + f1f5157 commit 4cf2d07

File tree

44 files changed

+397
-333
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+397
-333
lines changed

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

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,8 @@ public function testConvertToBuyRequest(
113113
$productOptionMock = $this->getMockBuilder(ProductOptionInterface::class)
114114
->getMockForAbstractClass();
115115

116-
$productOptionExtensionMock = $this->getMockBuilder(
117-
ProductOptionExtensionInterface::class
118-
)
119-
->onlyMethods([
120-
'getCustomOptions',
121-
])
116+
$productOptionExtensionMock = $this->getMockBuilder(ProductOptionExtensionInterface::class)
117+
->addMethods(['getCustomOptions'])
122118
->getMockForAbstractClass();
123119

124120
$productOptionMock->expects($this->any())

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,7 @@ public static function getStoreIdByCodeDataProvider(): array
11071107
* @return void
11081108
* @dataProvider validateRowCheckSpecifiedSkuDataProvider
11091109
*/
1110-
public function testValidateRowCheckSpecifiedSku($sku, $expectedError): void
1110+
public function testValidateRowCheckSpecifiedSku($sku): void
11111111
{
11121112
$importProduct = $this->createModelMockWithErrorAggregator(
11131113
['addRowError', 'getOptionEntity', 'getRowScope'],
@@ -1813,16 +1813,13 @@ public static function validateRowCheckSpecifiedSkuDataProvider(): array
18131813
{
18141814
return [
18151815
[
1816-
'$sku' => null,
1817-
'$expectedError' => Validator::ERROR_SKU_IS_EMPTY
1816+
'$sku' => null
18181817
],
18191818
[
1820-
'$sku' => false,
1821-
'$expectedError' => Validator::ERROR_ROW_IS_ORPHAN
1819+
'$sku' => false
18221820
],
18231821
[
1824-
'$sku' => 'sku',
1825-
'$expectedError' => Validator::ERROR_INVALID_STORE
1822+
'$sku' => 'sku'
18261823
]
18271824
];
18281825
}

app/code/Magento/CatalogInventory/Test/Unit/Api/StockRegistryTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,9 @@ class StockRegistryTest extends TestCase
6868
*/
6969
protected $product;
7070

71-
protected $productId = 111;
72-
protected $productSku = 'simple';
73-
protected $websiteId = 111;
71+
private const PRODUCT_ID = 111;
72+
private const PRODUCT_SKU = 'simple';
73+
private const WEBSITE_ID = 111;
7474

7575
protected function setUp(): void
7676
{
@@ -79,8 +79,8 @@ protected function setUp(): void
7979
$this->product = $this->createPartialMock(Product::class, ['__wakeup', 'getIdBySku']);
8080
$this->product->expects($this->any())
8181
->method('getIdBySku')
82-
->willReturn($this->productId);
83-
//getIdBySku
82+
->willReturn(self::PRODUCT_ID);
83+
8484
$this->productFactory = $this->createPartialMock(ProductFactory::class, ['create']);
8585
$this->productFactory->expects($this->any())
8686
->method('create')
@@ -147,35 +147,35 @@ protected function tearDown(): void
147147

148148
public function testGetStock()
149149
{
150-
$this->assertEquals($this->stock, $this->stockRegistry->getStock($this->websiteId));
150+
$this->assertEquals($this->stock, $this->stockRegistry->getStock(self::WEBSITE_ID));
151151
}
152152

153153
public function testGetStockItem()
154154
{
155-
$this->assertEquals($this->stockItem, $this->stockRegistry->getStockItem($this->productId, $this->websiteId));
155+
$this->assertEquals($this->stockItem, $this->stockRegistry->getStockItem(self::PRODUCT_ID, self::WEBSITE_ID));
156156
}
157157

158158
public function testGetStockItemBySku()
159159
{
160160
$this->assertEquals(
161161
$this->stockItem,
162-
$this->stockRegistry->getStockItemBySku($this->productSku, $this->websiteId)
162+
$this->stockRegistry->getStockItemBySku(self::PRODUCT_SKU, self::WEBSITE_ID)
163163
);
164164
}
165165

166166
public function testGetStockStatus()
167167
{
168168
$this->assertEquals(
169169
$this->stockStatus,
170-
$this->stockRegistry->getStockStatus($this->productId, $this->websiteId)
170+
$this->stockRegistry->getStockStatus(self::PRODUCT_ID, self::WEBSITE_ID)
171171
);
172172
}
173173

174174
public function testGetStockStatusBySku()
175175
{
176176
$this->assertEquals(
177177
$this->stockStatus,
178-
$this->stockRegistry->getStockStatus($this->productId, $this->websiteId)
178+
$this->stockRegistry->getStockStatus(self::PRODUCT_ID, self::WEBSITE_ID)
179179
);
180180
}
181181

@@ -188,7 +188,7 @@ public function testUpdateStockItemBySku()
188188
$this->stockItem->expects($this->atLeastOnce())->method('getItemId')->willReturn($itemId);
189189
$this->assertEquals(
190190
$itemId,
191-
$this->stockRegistry->updateStockItemBySku($this->productSku, $this->stockItem)
191+
$this->stockRegistry->updateStockItemBySku(self::PRODUCT_SKU, $this->stockItem)
192192
);
193193
}
194194
}

app/code/Magento/Cms/Test/Unit/Model/Wysiwyg/Images/StorageTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ class StorageTest extends TestCase
4242
/**
4343
* Directory paths samples
4444
*/
45-
const STORAGE_ROOT_DIR = '/storage/root/dir/';
45+
private const STORAGE_ROOT_DIR = '/storage/root/dir/';
4646

47-
const INVALID_DIRECTORY_OVER_ROOT = '/storage/some/another/dir';
47+
private const INVALID_DIRECTORY_OVER_ROOT = '/storage/some/another/dir';
4848

4949
/**
5050
* @var Storage

app/code/Magento/Customer/Test/Unit/Model/Account/RedirectTest.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
<?php declare(strict_types=1);
1+
<?php
22
/**
3-
* Unit test for Magento\Customer\Test\Unit\Model\Account\Redirect
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
6+
declare(strict_types=1);
87

98
namespace Magento\Customer\Test\Unit\Model\Account;
109

app/code/Magento/Fedex/Test/Unit/Model/CarrierTest.php

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -168,12 +168,12 @@ protected function setUp(): void
168168

169169
$this->trackErrorFactory = $this->getMockBuilder(ErrorFactory::class)
170170
->disableOriginalConstructor()
171-
->setMethods(['create'])
171+
->onlyMethods(['create'])
172172
->getMock();
173173

174174
$this->statusFactory = $this->getMockBuilder(StatusFactory::class)
175175
->disableOriginalConstructor()
176-
->setMethods(['create'])
176+
->onlyMethods(['create'])
177177
->getMock();
178178

179179
$elementFactory = $this->getMockBuilder(ElementFactory::class)
@@ -208,21 +208,21 @@ protected function setUp(): void
208208

209209
$this->curlFactory = $this->getMockBuilder(CurlFactory::class)
210210
->disableOriginalConstructor()
211-
->setMethods(['create'])
211+
->onlyMethods(['create'])
212212
->getMock();
213213

214214
$this->curlClient = $this->getMockBuilder(Curl::class)
215215
->disableOriginalConstructor()
216-
->setMethods(['setHeaders', 'getBody', 'post'])
216+
->onlyMethods(['setHeaders', 'getBody', 'post'])
217217
->getMock();
218218

219219
$this->decoderInterface = $this->getMockBuilder(DecoderInterface::class)
220220
->disableOriginalConstructor()
221-
->setMethods(['decode'])
221+
->onlyMethods(['decode'])
222222
->getMock();
223223

224224
$this->carrier = $this->getMockBuilder(Carrier::class)
225-
->setMethods(['rateRequest'])
225+
->addMethods(['rateRequest'])
226226
->setConstructorArgs(
227227
[
228228
'scopeConfig' => $this->scope,
@@ -368,7 +368,7 @@ public function testSetRequestWithoutCity(): void
368368
{
369369
$request = $this->getMockBuilder(RateRequest::class)
370370
->disableOriginalConstructor()
371-
->setMethods(['getDestCity'])
371+
->addMethods(['getDestCity'])
372372
->getMock();
373373
$request->expects($this->once())
374374
->method('getDestCity')
@@ -380,7 +380,7 @@ public function testSetRequestWithCity(): void
380380
{
381381
$request = $this->getMockBuilder(RateRequest::class)
382382
->disableOriginalConstructor()
383-
->setMethods(['getDestCity'])
383+
->addMethods(['getDestCity'])
384384
->getMock();
385385
$request->expects($this->exactly(2))
386386
->method('getDestCity')
@@ -462,7 +462,7 @@ public function testCollectRatesRateAmountOriginBased(
462462
->willReturn($baseCurrencyCode);
463463

464464
$request = $this->getMockBuilder(RateRequest::class)
465-
->setMethods(['getBaseCurrency'])
465+
->addMethods(['getBaseCurrency'])
466466
->disableOriginalConstructor()
467467
->getMock();
468468
$request->method('getBaseCurrency')
@@ -485,7 +485,7 @@ public function testCollectRatesRateAmountOriginBased(
485485
* Get list of rates variations
486486
* @return array
487487
*/
488-
public function collectRatesDataProvider(): array
488+
public static function collectRatesDataProvider(): array
489489
{
490490
return [
491491
[10.0, 'USD', 'EUR', 'RATED_ACCOUNT_PACKAGE', 7.5],
@@ -551,7 +551,7 @@ public function testFilterDebugData($data, array $maskFields, $expected): void
551551
/**
552552
* Get list of variations
553553
*/
554-
public function logDataProvider(): array
554+
public static function logDataProvider(): array
555555
{
556556
return [
557557
[
@@ -573,7 +573,7 @@ public function logDataProvider(): array
573573
* @param string $tracking
574574
* @return array
575575
*/
576-
public function getTrackRequest(string $tracking): array
576+
public static function getTrackRequest(string $tracking): array
577577
{
578578
return [
579579
'includeDetailedScans' => true,
@@ -1009,11 +1009,11 @@ private function initRateErrorFactory(): void
10091009
{
10101010
$this->error = $this->getMockBuilder(RateResultError::class)
10111011
->disableOriginalConstructor()
1012-
->setMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage'])
1012+
->addMethods(['setCarrier', 'setCarrierTitle', 'setErrorMessage'])
10131013
->getMock();
10141014
$this->errorFactory = $this->getMockBuilder(RateErrorFactory::class)
10151015
->disableOriginalConstructor()
1016-
->setMethods(['create'])
1016+
->onlyMethods(['create'])
10171017
->getMock();
10181018
$this->errorFactory->expects($this->any())
10191019
->method('create')
@@ -1028,11 +1028,11 @@ private function getRateFactory()
10281028
{
10291029
$rate = $this->getMockBuilder(RateResult::class)
10301030
->disableOriginalConstructor()
1031-
->setMethods(['getError'])
1031+
->onlyMethods(['getError'])
10321032
->getMock();
10331033
$rateFactory = $this->getMockBuilder(RateResultFactory::class)
10341034
->disableOriginalConstructor()
1035-
->setMethods(['create'])
1035+
->onlyMethods(['create'])
10361036
->getMock();
10371037
$rateFactory->expects($this->any())
10381038
->method('create')
@@ -1049,15 +1049,15 @@ private function getCountryFactory()
10491049
{
10501050
$country = $this->getMockBuilder(Country::class)
10511051
->disableOriginalConstructor()
1052-
->setMethods(['load', 'getData'])
1052+
->onlyMethods(['load', 'getData'])
10531053
->getMock();
10541054
$country->expects($this->any())
10551055
->method('load')
10561056
->willReturnSelf();
10571057

10581058
$countryFactory = $this->getMockBuilder(CountryFactory::class)
10591059
->disableOriginalConstructor()
1060-
->setMethods(['create'])
1060+
->onlyMethods(['create'])
10611061
->getMock();
10621062
$countryFactory->expects($this->any())
10631063
->method('create')
@@ -1074,7 +1074,7 @@ private function getResultFactory()
10741074
{
10751075
$resultFactory = $this->getMockBuilder(ResultFactory::class)
10761076
->disableOriginalConstructor()
1077-
->setMethods(['create'])
1077+
->onlyMethods(['create'])
10781078
->getMock();
10791079
$this->result = $this->helper->getObject(Result::class);
10801080
$resultFactory->expects($this->any())
@@ -1092,7 +1092,7 @@ private function getStoreManager()
10921092
{
10931093
$store = $this->getMockBuilder(Store::class)
10941094
->disableOriginalConstructor()
1095-
->setMethods(['getBaseCurrencyCode'])
1095+
->onlyMethods(['getBaseCurrencyCode'])
10961096
->getMock();
10971097
$storeManager = $this->getMockForAbstractClass(StoreManagerInterface::class);
10981098
$storeManager->expects($this->any())
@@ -1111,11 +1111,11 @@ private function getRateMethodFactory()
11111111
$priceCurrency = $this->getMockForAbstractClass(PriceCurrencyInterface::class);
11121112
$rateMethod = $this->getMockBuilder(Method::class)
11131113
->setConstructorArgs(['priceCurrency' => $priceCurrency])
1114-
->setMethods(null)
1114+
->onlyMethods([])
11151115
->getMock();
11161116
$rateMethodFactory = $this->getMockBuilder(MethodFactory::class)
11171117
->disableOriginalConstructor()
1118-
->setMethods(['create'])
1118+
->onlyMethods(['create'])
11191119
->getMock();
11201120
$rateMethodFactory->expects($this->any())
11211121
->method('create')

0 commit comments

Comments
 (0)