Skip to content

Commit 7dd6785

Browse files
Merge branch '2.4-develop' into MC-32830
2 parents 2e77bf6 + aff512b commit 7dd6785

File tree

28 files changed

+747
-77
lines changed

28 files changed

+747
-77
lines changed

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutShippingMethodsSection.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@
2121
<element name="freeShippingShippingMethod" type="input" selector="#s_method_freeshipping_freeshipping" timeout="30"/>
2222
<element name="noQuotesMsg" type="text" selector="#checkout-step-shipping_method div"/>
2323
<element name="price" type="text" selector="//*[@id='checkout-shipping-method-load']//td[@class='col col-price']"/>
24+
<element name="shippingRatePriceByName" type="text" selector="//div[@id='checkout-shipping-method-load']//td[contains(., '{{var1}}')]/..//td//span[contains(@class, 'price')]" parameterized="true"/>
2425
</section>
2526
</sections>

app/code/Magento/Checkout/view/frontend/web/js/view/billing-address.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,8 @@ function (
283283
label = _.map(attribute.value, function (value) {
284284
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
285285
}, this).join(', ');
286+
} else if (typeof attribute.value === 'object') {
287+
label = _.map(Object.values(attribute.value)).join(', ');
286288
} else {
287289
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
288290
}
@@ -310,6 +312,8 @@ function (
310312
if (option) {
311313
label = option.label;
312314
}
315+
} else if (value.file !== null) {
316+
label = value.file;
313317
}
314318

315319
return label;

app/code/Magento/Checkout/view/frontend/web/js/view/shipping-address/address-renderer/default.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ define([
6969
label = _.map(attribute.value, function (value) {
7070
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
7171
}, this).join(', ');
72+
} else if (typeof attribute.value === 'object') {
73+
label = _.map(Object.values(attribute.value)).join(', ');
7274
} else {
7375
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
7476
}
@@ -96,6 +98,8 @@ define([
9698
if (option) {
9799
label = option.label;
98100
}
101+
} else if (value.file !== null) {
102+
label = value.file;
99103
}
100104

101105
return label;

app/code/Magento/Checkout/view/frontend/web/js/view/shipping-information/address-renderer/default.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ define([
4646
label = _.map(attribute.value, function (value) {
4747
return this.getCustomAttributeOptionLabel(attribute['attribute_code'], value) || value;
4848
}, this).join(', ');
49+
} else if (typeof attribute.value === 'object') {
50+
label = _.map(Object.values(attribute.value)).join(', ');
4951
} else {
5052
label = this.getCustomAttributeOptionLabel(attribute['attribute_code'], attribute.value);
5153
}
@@ -73,6 +75,8 @@ define([
7375
if (option) {
7476
label = option.label;
7577
}
78+
} else if (value.file !== null) {
79+
label = value.file;
7680
}
7781

7882
return label;

app/code/Magento/ConfigurableProductGraphQl/Model/Cart/BuyRequest/SuperAttributeDataProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function execute(array $cartItemData): array
9393
throw new GraphQlNoSuchEntityException(__('Could not find specified product.'));
9494
}
9595

96-
$this->checkProductStock($sku, (float) $qty, (int) $cart->getStore()->getWebsite()->getId());
96+
$this->checkProductStock($sku, (float) $qty, (int) $cart->getStore()->getWebsiteId());
9797

9898
$configurableProductLinks = $parentProduct->getExtensionAttributes()->getConfigurableProductLinks();
9999
if (!in_array($product->getId(), $configurableProductLinks)) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\ConfigurableProductGraphQl\Test\Unit\Model\Cart\BuyRequest;
9+
10+
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Catalog\Model\Product;
12+
use Magento\CatalogInventory\Api\StockStateInterface;
13+
use Magento\ConfigurableProductGraphQl\Model\Cart\BuyRequest\SuperAttributeDataProvider;
14+
use Magento\ConfigurableProductGraphQl\Model\Options\Collection as OptionCollection;
15+
use Magento\Framework\EntityManager\MetadataPool;
16+
use Magento\Framework\Stdlib\ArrayManager;
17+
use Magento\Quote\Model\Quote;
18+
use Magento\Store\Api\Data\StoreInterface;
19+
use PHPUnit\Framework\MockObject\MockObject;
20+
use PHPUnit\Framework\TestCase;
21+
22+
/**
23+
* Test for SuperAttributeDataProvider
24+
*/
25+
class SuperAttributeDataProviderTest extends TestCase
26+
{
27+
/**
28+
* @var ArrayManager|MockObject
29+
*/
30+
private $arrayManager;
31+
32+
/**
33+
* @var ProductRepositoryInterface|MockObject
34+
*/
35+
private $productRepository;
36+
37+
/**
38+
* @var OptionCollection|MockObject
39+
*/
40+
private $optionCollection;
41+
42+
/**
43+
* @var MetadataPool|MockObject
44+
*/
45+
private $metadataPool;
46+
47+
/**
48+
* @var StockStateInterface|MockObject
49+
*/
50+
private $stockState;
51+
52+
/**
53+
* @var SuperAttributeDataProvider|MockObject
54+
*/
55+
private $superAttributeDataProvider;
56+
57+
/**
58+
* @inheritDoc
59+
*/
60+
protected function setUp(): void
61+
{
62+
$this->arrayManager = $this->getMockBuilder(ArrayManager::class)
63+
->disableOriginalConstructor()
64+
->getMock();
65+
$this->productRepository = $this->getMockBuilder(ProductRepositoryInterface::class)
66+
->disableOriginalConstructor()
67+
->getMockForAbstractClass();
68+
$this->optionCollection = $this->createMock(OptionCollection::class);
69+
$this->metadataPool = $this->getMockBuilder(MetadataPool::class)
70+
->disableOriginalConstructor()
71+
->onlyMethods(['getMetadata'])
72+
->addMethods(['getLinkField'])
73+
->getMock();
74+
$this->stockState = $this->getMockBuilder(StockStateInterface::class)
75+
->disableOriginalConstructor()
76+
->addMethods(['getHasError'])
77+
->getMockForAbstractClass();
78+
79+
$this->superAttributeDataProvider = new SuperAttributeDataProvider(
80+
$this->arrayManager,
81+
$this->productRepository,
82+
$this->optionCollection,
83+
$this->metadataPool,
84+
$this->stockState
85+
);
86+
}
87+
88+
/**
89+
* Check that website id is correctly retrieved
90+
*/
91+
public function testExecute(): void
92+
{
93+
$quoteMock = $this->getMockBuilder(Quote::class)
94+
->disableOriginalConstructor()
95+
->getMock();
96+
$cartItemData = [
97+
'data' => [
98+
'quantity' => 2.0,
99+
'sku' => 'simple1',
100+
],
101+
'parent_sku' => 'configurable',
102+
'model' => $quoteMock,
103+
];
104+
105+
$this->arrayManager->method('get')
106+
->withConsecutive(
107+
['parent_sku', $cartItemData],
108+
['data/sku', $cartItemData],
109+
['data/quantity', $cartItemData],
110+
['model', $cartItemData],
111+
)
112+
->willReturnOnConsecutiveCalls(
113+
'configurable',
114+
'simple1',
115+
2.0,
116+
$quoteMock,
117+
);
118+
119+
$storeMock = $this->getMockBuilder(StoreInterface::class)
120+
->disableOriginalConstructor()
121+
->addMethods(['getWebsite'])
122+
->getMockForAbstractClass();
123+
$storeMock->expects($this->once())->method('getWebsiteId')->willReturn(1);
124+
$storeMock->expects($this->never())->method('getWebsite');
125+
$quoteMock->expects($this->atLeastOnce())
126+
->method('getStore')
127+
->willReturn($storeMock);
128+
129+
$productMock = $this->getMockBuilder(Product::class)
130+
->disableOriginalConstructor()
131+
->onlyMethods(['getId', 'getExtensionAttributes', 'getData'])
132+
->addMethods(['getConfigurableProductLinks'])
133+
->getMock();
134+
$productMock->method('getId')
135+
->willReturn(1);
136+
$productMock->method('getExtensionAttributes')
137+
->willReturnSelf();
138+
$productMock->method('getConfigurableProductLinks')
139+
->willReturn([1]);
140+
$productMock->method('getData')
141+
->willReturn(1);
142+
$this->productRepository->method('get')
143+
->willReturn($productMock);
144+
$this->stockState->method('checkQuoteItemQty')
145+
->willReturnSelf();
146+
$this->stockState->method('getHasError')
147+
->willReturn(false);
148+
$this->metadataPool->method('getMetadata')
149+
->willReturnSelf();
150+
$this->metadataPool->method('getLinkField')
151+
->willReturnSelf();
152+
$this->optionCollection->method('getAttributesByProductId')
153+
->willReturn([
154+
[
155+
'attribute_code' => 'code',
156+
'attribute_id' => 1,
157+
'values' => [['value_index' => 1]],
158+
]
159+
]);
160+
161+
$this->assertEquals(['super_attribute' => [1 => 1]], $this->superAttributeDataProvider->execute($cartItemData));
162+
}
163+
}

app/code/Magento/Customer/Controller/Adminhtml/File/Customer/Upload.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
use Magento\Framework\Exception\LocalizedException;
1515
use Psr\Log\LoggerInterface;
1616

17+
/**
18+
* Class for upload customer file attribute
19+
*/
1720
class Upload extends Action
1821
{
1922
/**
@@ -38,6 +41,11 @@ class Upload extends Action
3841
*/
3942
private $logger;
4043

44+
/**
45+
* @var string
46+
*/
47+
private $scope;
48+
4149
/**
4250
* @param Context $context
4351
* @param FileUploaderFactory $fileUploaderFactory
@@ -65,15 +73,15 @@ public function execute()
6573
if (empty($_FILES)) {
6674
throw new \Exception('$_FILES array is empty.');
6775
}
68-
69-
$attributeCode = key($_FILES['customer']['name']);
76+
$scope = array_key_first($_FILES);
77+
$attributeCode = key($_FILES[$scope]['name']);
7078
$attributeMetadata = $this->customerMetadataService->getAttributeMetadata($attributeCode);
7179

7280
/** @var FileUploader $fileUploader */
7381
$fileUploader = $this->fileUploaderFactory->create([
7482
'attributeMetadata' => $attributeMetadata,
7583
'entityTypeCode' => CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER,
76-
'scope' => 'customer',
84+
'scope' => $scope,
7785
]);
7886

7987
$errors = $fileUploader->validate();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="CliIndexerSetRealtimeModeActionGroup">
11+
<annotations>
12+
<description>Set indexers to realtime mode.</description>
13+
</annotations>
14+
15+
<magentoCLI command="indexer:set-mode" arguments="realtime" stepKey="setRealtimeIndexerMode"/>
16+
</actionGroup>
17+
</actionGroups>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
10+
<actionGroup name="CliIndexerSetScheduleModeActionGroup">
11+
<annotations>
12+
<description>Set indexers to schedule mode.</description>
13+
</annotations>
14+
15+
<magentoCLI command="indexer:set-mode" arguments="schedule" stepKey="setScheduleIndexerMode"/>
16+
</actionGroup>
17+
</actionGroups>

app/code/Magento/OfflineShipping/Model/Carrier/Flatrate.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,14 @@ private function getFreeBoxesCount(RateRequest $request)
113113
continue;
114114
}
115115

116+
$freeShippingMethod = $item->getFreeShippingMethod();
117+
116118
if ($item->getHasChildren() && $item->isShipSeparately()) {
117119
$freeBoxes += $this->getFreeBoxesCountFromChildren($item);
118-
} elseif ($item->getFreeShipping()) {
120+
} elseif (
121+
$item->getFreeShipping()
122+
&& ($freeShippingMethod === null || $freeShippingMethod === 'flatrate_flatrate')
123+
) {
119124
$freeBoxes += $item->getQty();
120125
}
121126
}

0 commit comments

Comments
 (0)