Skip to content

Commit e77413a

Browse files
Merge branch '2.4-develop' into patch-21
2 parents dad1949 + e81f28e commit e77413a

File tree

1,899 files changed

+14014
-9250
lines changed

Some content is hidden

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

1,899 files changed

+14014
-9250
lines changed

app/code/Magento/AdminNotification/Test/Unit/Observer/PredispatchAdminActionControllerObserverTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,17 @@ protected function setUp(): void
6868

6969
$this->backendAuthSessionMock = $this->getMockBuilder(Session::class)
7070
->disableOriginalConstructor()
71-
->setMethods(['isLoggedIn'])
71+
->onlyMethods(['isLoggedIn'])
7272
->getMock();
7373

7474
$this->feedMock = $this->getMockBuilder(Feed::class)
7575
->disableOriginalConstructor()
76-
->setMethods(['checkUpdate'])
76+
->onlyMethods(['checkUpdate'])
7777
->getMock();
7878

7979
$this->feedFactoryMock = $this->getMockBuilder(FeedFactory::class)
8080
->disableOriginalConstructor()
81-
->setMethods(['create'])
81+
->onlyMethods(['create'])
8282
->getMock();
8383

8484
$this->observer = $this->objectManager->getObject(

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ protected function setUp(): void
5454
{
5555
$this->groupRepository = $this->getMockBuilder(GroupRepositoryInterface::class)
5656
->disableOriginalConstructor()
57-
->setMethods(['getList'])
57+
->onlyMethods(['getList'])
5858
->getMockForAbstractClass();
5959

6060
$this->searchCriteriaBuilder = $this->createMock(SearchCriteriaBuilder::class);
@@ -65,7 +65,7 @@ protected function setUp(): void
6565
$this->tierPrice = $this->getMockBuilder(
6666
TierPrice::class
6767
)
68-
->setMethods(['isValidValueAndLength', 'hasEmptyColumns', '_addMessages'])
68+
->onlyMethods(['isValidValueAndLength', 'hasEmptyColumns', '_addMessages'])
6969
->setConstructorArgs([$this->groupRepository, $this->searchCriteriaBuilder, $this->storeResolver])
7070
->getMock();
7171
}
@@ -87,7 +87,7 @@ public function testInitInternalCalls()
8787

8888
$groupTest = $this->getMockBuilder(GroupInterface::class)
8989
->disableOriginalConstructor()
90-
->setMethods(['getCode', 'getId'])
90+
->onlyMethods(['getCode', 'getId'])
9191
->getMockForAbstractClass();
9292
$groupTest->expects($this->once())->method('getCode');
9393
$groupTest->method('getId');
@@ -114,7 +114,7 @@ public function testInitAddToCustomerGroups()
114114

115115
$groupTest = $this->getMockBuilder(GroupInterface::class)
116116
->disableOriginalConstructor()
117-
->setMethods(['getCode', 'getId'])
117+
->onlyMethods(['getCode', 'getId'])
118118
->getMockForAbstractClass();
119119

120120
$expectedCode = 'code';
@@ -184,7 +184,7 @@ public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGr
184184

185185
$groupTest = $this->getMockBuilder(GroupInterface::class)
186186
->disableOriginalConstructor()
187-
->setMethods(['getCode', 'getId'])
187+
->onlyMethods(['getCode', 'getId'])
188188
->getMockForAbstractClass();
189189
$groupTest->expects($this->once())->method('getCode');
190190
$groupTest->method('getId');
@@ -198,7 +198,7 @@ public function testIsValidAddMessagesCall($value, $hasEmptyColumns, $customerGr
198198
/**
199199
* @return array
200200
*/
201-
public function isValidResultFalseDataProvider()
201+
public static function isValidResultFalseDataProvider()
202202
{
203203
return [
204204
// First if condition cases.
@@ -306,7 +306,7 @@ public function isValidResultFalseDataProvider()
306306
/**
307307
* @return array
308308
*/
309-
public function isValidAddMessagesCallDataProvider()
309+
public static function isValidAddMessagesCallDataProvider()
310310
{
311311
return [
312312
// First if condition cases.

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/TierPriceTypeTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function testIsValid(array $value, $expectedResult)
5151
*
5252
* @return array
5353
*/
54-
public function isValidDataProvider()
54+
public static function isValidDataProvider()
5555
{
5656
return [
5757
[

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/Validator/WebsiteTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ class WebsiteTest extends TestCase
4040
protected function setUp(): void
4141
{
4242
$this->webSiteModel = $this->getMockBuilder(Website::class)
43-
->setMethods(['getBaseCurrency'])
43+
->onlyMethods(['getBaseCurrency'])
4444
->disableOriginalConstructor()
4545
->getMock();
4646
$this->storeResolver = $this->createPartialMock(
@@ -56,7 +56,7 @@ protected function setUp(): void
5656
$this->website = $this->getMockBuilder(
5757
WebsiteValidator::class
5858
)
59-
->setMethods(['getAllWebsitesValue', '_clearMessages', '_addMessages'])
59+
->onlyMethods(['getAllWebsitesValue', '_clearMessages', '_addMessages'])
6060
->setConstructorArgs([$this->storeResolver, $this->webSiteModel, $this->currencyResolver])
6161
->getMock();
6262
}
@@ -121,7 +121,7 @@ public function testGetAllWebsitesValue()
121121
$websiteString = $this->getMockBuilder(
122122
WebsiteValidator::class
123123
)
124-
->setMethods(['_clearMessages', '_addMessages'])
124+
->onlyMethods(['_clearMessages', '_addMessages'])
125125
->setConstructorArgs([$this->storeResolver, $this->webSiteModel, $this->currencyResolver])
126126
->getMock();
127127
$result = $websiteString->getAllWebsitesValue();
@@ -132,7 +132,7 @@ public function testGetAllWebsitesValue()
132132
/**
133133
* @return array
134134
*/
135-
public function isValidReturnDataProvider()
135+
public static function isValidReturnDataProvider()
136136
{
137137
return [
138138
// False cases.

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricing/ValidatorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ protected function setUp(): void
4444
$this->validator = $this->getMockBuilder(
4545
\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator::class
4646
)
47-
->setMethods(['_clearMessages', '_addMessages'])
47+
->onlyMethods(['_clearMessages', '_addMessages'])
4848
->setConstructorArgs([$this->validators])
4949
->getMock();
5050
}
@@ -84,7 +84,7 @@ public function testInit()
8484
/**
8585
* @return array
8686
*/
87-
public function isValidDataProvider()
87+
public static function isValidDataProvider()
8888
{
8989
return [
9090
[

app/code/Magento/AdvancedPricingImportExport/Test/Unit/Model/Import/AdvancedPricingTest.php

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\AdvancedPricingImportExport\Test\Unit\Model\Import;
99

10+
use Magento\AdvancedPricingImportExport\Model\CurrencyResolver;
1011
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing as AdvancedPricing;
1112
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator;
1213
use Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing\Validator\TierPrice;
@@ -137,6 +138,11 @@ class AdvancedPricingTest extends AbstractImportTestCase
137138
*/
138139
protected $errorAggregator;
139140

141+
/**
142+
* @var MockObject|CurrencyResolver
143+
*/
144+
private $currencyResolver;
145+
140146
/**
141147
* @inheritDoc
142148
*/
@@ -537,23 +543,23 @@ public function testSaveAndReplaceAdvancedPricesReplaceBehaviourInternalCalls():
537543

538544
$this->advancedPricing
539545
->method('deleteProductTierPrices')
540-
->withConsecutive(
541-
[
542-
$listSku,
543-
AdvancedPricing::TABLE_TIER_PRICE
544-
]
545-
)
546-
->willReturn(true);
546+
->willReturnCallback(
547+
function ($arg1, $arg2) use ($listSku) {
548+
if ($arg1 == $listSku && $arg2 == AdvancedPricing::TABLE_TIER_PRICE) {
549+
return true;
550+
}
551+
}
552+
);
547553

548554
$this->advancedPricing
549555
->method('saveProductPrices')
550-
->withConsecutive(
551-
[
552-
$expectedTierPrices,
553-
AdvancedPricing::TABLE_TIER_PRICE
554-
]
555-
)
556-
->willReturnSelf();
556+
->willReturnCallback(
557+
function ($arg1, $arg2) use ($expectedTierPrices) {
558+
if ($arg1 == $expectedTierPrices && $arg2 == AdvancedPricing::TABLE_TIER_PRICE) {
559+
return $this->advancedPricing;
560+
}
561+
}
562+
);
557563

558564
$this->invokeMethod($this->advancedPricing, 'saveAndReplaceAdvancedPrices');
559565
}
@@ -584,9 +590,13 @@ public function testDeleteAdvancedPricingFormListSkuToDelete(): void
584590
$this->advancedPricing
585591
->expects($this->once())
586592
->method('deleteProductTierPrices')
587-
->withConsecutive(
588-
[$expectedSkuList, AdvancedPricing::TABLE_TIER_PRICE]
589-
)->willReturnSelf();
593+
->willReturnCallback(
594+
function ($arg1, $arg2) use ($expectedSkuList) {
595+
if ($arg1 == $expectedSkuList && $arg2 == AdvancedPricing::TABLE_TIER_PRICE) {
596+
return $this->advancedPricing;
597+
}
598+
}
599+
);
590600

591601
$this->advancedPricing->deleteAdvancedPricing();
592602
}
@@ -630,7 +640,7 @@ public function testReplaceAdvancedPricing(): void
630640
*
631641
* @return array
632642
*/
633-
public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider(): array
643+
public static function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider(): array
634644
{
635645
// @codingStandardsIgnoreStart
636646
return [
@@ -759,7 +769,7 @@ public function saveAndReplaceAdvancedPricesAppendBehaviourDataProvider(): array
759769
*
760770
* @return array
761771
*/
762-
public function validateRowResultDataProvider(): array
772+
public static function validateRowResultDataProvider(): array
763773
{
764774
return [
765775
[
@@ -791,7 +801,7 @@ public function validateRowResultDataProvider(): array
791801
*
792802
* @return array
793803
*/
794-
public function validateRowAddRowErrorCallDataProvider(): array
804+
public static function validateRowAddRowErrorCallDataProvider(): array
795805
{
796806
return [
797807
[
@@ -836,7 +846,7 @@ public function testSaveProductPrices(array $priceData, array $oldSkus, array $p
836846
/**
837847
* @return array
838848
*/
839-
public function saveProductPricesDataProvider(): array
849+
public static function saveProductPricesDataProvider(): array
840850
{
841851
return [
842852
[[], ['oSku1' => 'product1', 'oSku2' => 'product2'], [], 0],
@@ -912,7 +922,7 @@ public function testDeleteProductTierPrices(
912922
/**
913923
* @return array
914924
*/
915-
public function deleteProductTierPricesDataProvider(): array
925+
public static function deleteProductTierPricesDataProvider(): array
916926
{
917927
return [
918928
[
@@ -991,15 +1001,19 @@ public function testProcessCountExistingPrices(
9911001
->willReturn($oldSkus);
9921002
$this->advancedPricing->expects($this->exactly($numCall))
9931003
->method('incrementCounterUpdated')
994-
->withConsecutive($args);
1004+
->willReturnCallback(function ($args) {
1005+
if (!empty($args)) {
1006+
return null;
1007+
}
1008+
});
9951009

9961010
$this->invokeMethod($this->advancedPricing, 'processCountExistingPrices', [$prices, 'table']);
9971011
}
9981012

9991013
/**
10001014
* @return array
10011015
*/
1002-
public function processCountExistingPricesDataProvider(): array
1016+
public static function processCountExistingPricesDataProvider(): array
10031017
{
10041018
return [
10051019
[
@@ -1095,10 +1109,11 @@ private function getAdvancedPricingMock(array $methods = []): MockObject
10951109
->method('getMetaData')
10961110
->with(ProductInterface::class)
10971111
->willReturn($metadataMock);
1112+
$this->currencyResolver = $this->createMock(CurrencyResolver::class);
10981113
$advancedPricingMock = $this->getMockBuilder(
10991114
\Magento\AdvancedPricingImportExport\Model\Import\AdvancedPricing::class
11001115
)
1101-
->setMethods($methods)
1116+
->onlyMethods($methods)
11021117
->setConstructorArgs(
11031118
[
11041119
$this->jsonHelper,
@@ -1115,7 +1130,8 @@ private function getAdvancedPricingMock(array $methods = []): MockObject
11151130
$this->importProduct,
11161131
$this->validator,
11171132
$this->websiteValidator,
1118-
$this->tierPriceValidator
1133+
$this->tierPriceValidator,
1134+
$this->currencyResolver
11191135
]
11201136
)
11211137
->getMock();

app/code/Magento/AdvancedSearch/Test/Unit/Block/SearchDataTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,16 @@ protected function setUp(): void
5151
{
5252
$this->dataProvider = $this->getMockBuilder(SuggestedQueriesInterface::class)
5353
->disableOriginalConstructor()
54-
->setMethods(['getItems', 'isResultsCountEnabled'])
54+
->onlyMethods(['getItems', 'isResultsCountEnabled'])
5555
->getMockForAbstractClass();
5656

5757
$this->searchQueryMock = $this->getMockBuilder(QueryInterface::class)
5858
->disableOriginalConstructor()
59-
->setMethods(['getQueryText'])
59+
->onlyMethods(['getQueryText'])
6060
->getMockForAbstractClass();
6161
$this->queryFactoryMock = $this->getMockBuilder(QueryFactoryInterface::class)
6262
->disableOriginalConstructor()
63-
->setMethods(['get'])
63+
->onlyMethods(['get'])
6464
->getMockForAbstractClass();
6565
$this->queryFactoryMock->expects($this->once())
6666
->method('get')
@@ -78,7 +78,7 @@ protected function setUp(): void
7878
[],
7979
]
8080
)
81-
->setMethods(['getUrl'])
81+
->onlyMethods(['getUrl'])
8282
->getMockForAbstractClass();
8383
}
8484

app/code/Magento/AdvancedSearch/Test/Unit/Controller/Adminhtml/Search/System/Config/TestConnectionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ protected function setUp(): void
7575
$responseMock = $this->createMock(HttpResponse::class);
7676

7777
$context = $this->getMockBuilder(Context::class)
78-
->setMethods(['getRequest', 'getResponse', 'getMessageManager', 'getSession'])
78+
->onlyMethods(['getRequest', 'getResponse', 'getMessageManager', 'getSession'])
7979
->setConstructorArgs(
8080
$helper->getConstructArguments(
8181
Context::class,
@@ -90,7 +90,7 @@ protected function setUp(): void
9090

9191
$this->clientResolverMock = $this->getMockBuilder(ClientResolver::class)
9292
->disableOriginalConstructor()
93-
->setMethods(['create'])
93+
->onlyMethods(['create'])
9494
->getMock();
9595

9696
$this->clientMock = $this->getMockForAbstractClass(ClientInterface::class);
@@ -101,12 +101,12 @@ protected function setUp(): void
101101

102102
$this->resultJsonFactoryMock = $this->getMockBuilder(JsonFactory::class)
103103
->disableOriginalConstructor()
104-
->setMethods(['create'])
104+
->onlyMethods(['create'])
105105
->getMock();
106106

107107
$this->tagFilterMock = $this->getMockBuilder(StripTags::class)
108108
->disableOriginalConstructor()
109-
->setMethods(['filter'])
109+
->onlyMethods(['filter'])
110110
->getMock();
111111

112112
$this->controller = new TestConnection(

app/code/Magento/AdvancedSearch/Test/Unit/Model/Recommendations/DataProviderTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected function setUp(): void
8080
$this->scopeConfigMock = $this->getMockForAbstractClass(ScopeConfigInterface::class);
8181
$this->layerResolverMock = $this->getMockBuilder(Resolver::class)
8282
->disableOriginalConstructor()
83-
->setMethods(['get'])
83+
->onlyMethods(['get'])
8484
->getMock();
8585

8686
$this->searchLayerMock = $this->createMock(SearchLayer::class);
@@ -91,14 +91,14 @@ protected function setUp(): void
9191

9292
$this->recommendationsFactoryMock = $this->getMockBuilder(RecommendationsFactory::class)
9393
->disableOriginalConstructor()
94-
->setMethods(['create'])
94+
->onlyMethods(['create'])
9595
->getMock();
9696

9797
$this->recommendationsMock = $this->createMock(Recommendations::class);
9898

9999
$this->queryResultFactoryMock = $this->getMockBuilder(QueryResultFactory::class)
100100
->disableOriginalConstructor()
101-
->setMethods(['create'])
101+
->onlyMethods(['create'])
102102
->getMock();
103103

104104
$this->objectManagerHelper = new ObjectManagerHelper($this);

0 commit comments

Comments
 (0)