Skip to content

Commit c4bc323

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into BUG#AC-853
2 parents 3fdf706 + 203a44f commit c4bc323

File tree

108 files changed

+22205
-17545
lines changed

Some content is hidden

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

108 files changed

+22205
-17545
lines changed

app/code/Magento/Backend/App/DefaultPath.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?php
22
/**
3-
* Default application path for backend area
4-
*
53
* Copyright © Magento, Inc. All rights reserved.
64
* See COPYING.txt for license details.
75
*/
86
namespace Magento\Backend\App;
97

108
/**
9+
* Default application path for backend area
10+
*
1111
* @api
1212
* @since 100.0.2
1313
*/
@@ -24,7 +24,11 @@ class DefaultPath implements \Magento\Framework\App\DefaultPathInterface
2424
*/
2525
public function __construct(\Magento\Backend\App\ConfigInterface $config)
2626
{
27-
$pathParts = explode('/', $config->getValue('web/default/admin'));
27+
$pathConfigValue = $config->getValue('web/default/admin') ?? '';
28+
$pathParts = [];
29+
if ($pathConfigValue) {
30+
$pathParts = explode('/', $pathConfigValue);
31+
}
2832

2933
$this->_parts = [
3034
'area' => isset($pathParts[0]) ? $pathParts[0] : '',

app/code/Magento/Backend/view/adminhtml/templates/widget/tabshoriz.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use Magento\Framework\View\Helper\SecureHtmlRenderer;
1919
<?php foreach ($tabs as $_tab): ?>
2020
<?php $tabId = $block->getTabId($_tab) ?>
2121
<?php $_tabClass = 'tab-item-link ' . $block->getTabClass($_tab) . ' ' .
22-
(preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') ?>
22+
($_tab->getClass() !== null ? (preg_match('/\s?ajax\s?/', $_tab->getClass()) ? 'notloaded' : '') : '') ?>
2323
<?php $_tabType = (!preg_match('/\s?ajax\s?/', $_tabClass) && $block->getTabUrl($_tab) != '#') ? 'link' : '' ?>
2424
<?php $_tabHref = $block->getTabUrl($_tab) == '#' ?
2525
'#' . $tabId . '_content' :

app/code/Magento/Catalog/Test/Mftf/ActionGroup/AddCategoryImageActionGroup.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<waitForElementVisible selector="{{AdminCategoryContentSection.uploadButton}}" stepKey="seeImageSectionIsReady"/>
2222
<attachFile selector="{{AdminCategoryContentSection.uploadImageFile}}" userInput="{{image.file}}" stepKey="uploadFile"/>
2323
<comment userInput="BIC workaround" stepKey="waitForAjaxUpload"/>
24-
<waitForPageLoad stepKey="waitForLoading"/>
24+
<waitForElementVisible selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="waitForLoading"/>
2525
<grabTextFrom selector="{{AdminCategoryContentSection.imageFileName}}" stepKey="grabCategoryFileName"/>
2626
<assertRegExp stepKey="assertEquals" message="pass">
2727
<expectedResult type="string">/magento-logo(_[0-9]+)*?\.png$/</expectedResult>

app/code/Magento/Catalog/view/adminhtml/web/js/category-tree.js

Lines changed: 18 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ define([
1616
url: '',
1717
data: [],
1818
tree: {
19-
plugins: ['themes', 'json_data', 'ui', 'hotkeys'],
20-
themes: {
21-
theme: 'default',
22-
dots: false,
23-
icons: true
19+
core: {
20+
themes: {
21+
dots: false
22+
}
2423
}
2524
}
2625
},
@@ -33,27 +32,8 @@ define([
3332
{},
3433
options.tree,
3534
{
36-
'json_data': {
37-
ajax: {
38-
url: options.url,
39-
type: 'POST',
40-
success: $.proxy(function (nodes) {
41-
return this._convertDataNodes(nodes);
42-
}, this),
43-
44-
/**
45-
* @param {HTMLElement} node
46-
* @return {Object}
47-
*/
48-
data: function (node) {
49-
return {
50-
id: $(node).data('id'),
51-
'form_key': window.FORM_KEY
52-
};
53-
}
54-
},
55-
data: this._convertData(options.data).children,
56-
'progressive_render': true
35+
core: {
36+
data: this._convertData(this.options.data).children
5737
}
5838
}
5939
);
@@ -68,9 +48,9 @@ define([
6848
* @private
6949
*/
7050
_selectNode: function (event, data) {
71-
var node = data.rslt.obj.data();
51+
var node = data.node;
7252

73-
if (!node.disabled) {
53+
if (!node.state.disabled) {
7454
window.location = window.location + '/' + node.id;
7555
} else {
7656
event.preventDefault();
@@ -85,7 +65,7 @@ define([
8565
_convertDataNodes: function (nodes) {
8666
var nodesData = [];
8767

88-
nodes.forEach(function (node) {
68+
nodes.children.forEach(function (node) {
8969
nodesData.push(this._convertData(node));
9070
}, this);
9171

@@ -104,25 +84,19 @@ define([
10484
if (!node) {
10585
return result;
10686
}
87+
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
10788
result = {
108-
data: {
109-
title: utils.unescape(node.name) + ' (' + node['product_count'] + ')'
89+
id: node.id,
90+
text: utils.unescape(node.name) + ' (' + node.product_count + ')',
91+
li_attr: {
92+
class: node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
11093
},
111-
attr: {
112-
'class': node.cls + (!!node.disabled ? ' disabled' : '') //eslint-disable-line no-extra-boolean-cast
113-
},
114-
metadata: {
115-
id: node.id,
116-
disabled: node.disabled
94+
state: {
95+
disabled: node.disabled,
96+
opened: !!node.children_count && node.expanded
11797
}
11898
};
119-
120-
if (node['children_count'] && !node.expanded) {
121-
result.state = 'closed';
122-
} else {
123-
result.state = 'open';
124-
}
125-
99+
// jscs:enable requireCamelCaseOrUpperCaseIdentifiers
126100
if (node.children) {
127101
result.children = [];
128102
$.each(node.children, function () {

app/code/Magento/Catalog/view/frontend/web/js/catalog-add-to-cart.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ define([
3434
if (this.options.bindSubmit) {
3535
this._bindSubmit();
3636
}
37-
$(this.options.addToCartButtonSelector).attr('disabled', false);
37+
$(this.options.addToCartButtonSelector).prop('disabled', false);
3838
},
3939

4040
/**
@@ -101,7 +101,7 @@ define([
101101
formData = new FormData(form[0]);
102102

103103
$.ajax({
104-
url: form.attr('action'),
104+
url: form.prop('action'),
105105
data: formData,
106106
type: 'post',
107107
dataType: 'json',
@@ -201,7 +201,7 @@ define([
201201

202202
addToCartButton.addClass(this.options.addToCartButtonDisabledClass);
203203
addToCartButton.find('span').text(addToCartButtonTextWhileAdding);
204-
addToCartButton.attr('title', addToCartButtonTextWhileAdding);
204+
addToCartButton.prop('title', addToCartButtonTextWhileAdding);
205205
},
206206

207207
/**
@@ -213,14 +213,14 @@ define([
213213
addToCartButton = $(form).find(this.options.addToCartButtonSelector);
214214

215215
addToCartButton.find('span').text(addToCartButtonTextAdded);
216-
addToCartButton.attr('title', addToCartButtonTextAdded);
216+
addToCartButton.prop('title', addToCartButtonTextAdded);
217217

218218
setTimeout(function () {
219219
var addToCartButtonTextDefault = self.options.addToCartButtonTextDefault || $t('Add to Cart');
220220

221221
addToCartButton.removeClass(self.options.addToCartButtonDisabledClass);
222222
addToCartButton.find('span').text(addToCartButtonTextDefault);
223-
addToCartButton.attr('title', addToCartButtonTextDefault);
223+
addToCartButton.prop('title', addToCartButtonTextDefault);
224224
}, 1000);
225225
}
226226
});

app/code/Magento/Checkout/Model/GuestPaymentInformationManagement.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ public function savePaymentInformation(
176176
}
177177
$this->limitShippingCarrier($quote);
178178

179+
if (!(int)$quote->getItemsQty()) {
180+
throw new CouldNotSaveException(__('Some of the products are disabled.'));
181+
}
182+
179183
$this->paymentMethodManagement->set($cartId, $paymentMethod);
180184
return true;
181185
}

app/code/Magento/Checkout/Test/Unit/Model/GuestPaymentInformationManagementTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ public function testSavePaymentInformationWithoutBillingAddress()
180180
$paymentMock = $this->getMockForAbstractClass(PaymentInterface::class);
181181
$billingAddressMock = $this->getMockForAbstractClass(AddressInterface::class);
182182
$quoteMock = $this->createMock(Quote::class);
183+
$quoteMock->expects($this->any())->method('getItemsQty')->willReturn(1);
183184

184185
$billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf();
185186

@@ -210,6 +211,7 @@ public function testSavePaymentInformationAndPlaceOrderWithLocalizedException()
210211

211212
$quoteMock = $this->createMock(Quote::class);
212213
$quoteMock->method('getBillingAddress')->willReturn($billingAddressMock);
214+
$quoteMock->expects($this->any())->method('getItemsQty')->willReturn(1);
213215
$this->cartRepositoryMock->method('getActive')->with($cartId)->willReturn($quoteMock);
214216

215217
$quoteIdMask = $this->getMockBuilder(QuoteIdMask::class)
@@ -231,6 +233,35 @@ public function testSavePaymentInformationAndPlaceOrderWithLocalizedException()
231233
$this->model->savePaymentInformationAndPlaceOrder($cartId, $email, $paymentMock, $billingAddressMock);
232234
}
233235

236+
public function testSavePaymentInformationAndPlaceOrderWithDisabledProduct()
237+
{
238+
$this->expectException('Magento\Framework\Exception\CouldNotSaveException');
239+
$this->expectExceptionMessage('Some of the products are disabled.');
240+
$cartId = 100;
241+
$email = 'email@magento.com';
242+
$paymentMock = $this->getMockForAbstractClass(PaymentInterface::class);
243+
$billingAddressMock = $this->getMockForAbstractClass(AddressInterface::class);
244+
245+
$quoteMock = $this->createMock(Quote::class);
246+
$quoteMock->method('getBillingAddress')->willReturn($billingAddressMock);
247+
$quoteMock->expects($this->any())->method('getItemsQty')->willReturn(0);
248+
$this->cartRepositoryMock->method('getActive')->with($cartId)->willReturn($quoteMock);
249+
250+
$quoteIdMask = $this->getMockBuilder(QuoteIdMask::class)
251+
->addMethods(['getQuoteId'])
252+
->onlyMethods(['load'])
253+
->disableOriginalConstructor()
254+
->getMock();
255+
$this->quoteIdMaskFactoryMock->method('create')->willReturn($quoteIdMask);
256+
$quoteIdMask->method('load')->with($cartId, 'masked_id')->willReturnSelf();
257+
$quoteIdMask->method('getQuoteId')->willReturn($cartId);
258+
259+
$billingAddressMock->expects($this->once())->method('setEmail')->with($email)->willReturnSelf();
260+
261+
$this->paymentMethodManagementMock->expects($this->never())->method('set')->with($cartId, $paymentMock);
262+
$this->model->savePaymentInformationAndPlaceOrder($cartId, $email, $paymentMock, $billingAddressMock);
263+
}
264+
234265
/**
235266
* @param int $cartId
236267
* @param MockObject $billingAddressMock
@@ -266,6 +297,9 @@ private function getMockForAssignBillingAddress(
266297
$this->cartRepositoryMock->method('getActive')
267298
->with($cartId)
268299
->willReturn($quote);
300+
$quote->expects($this->any())
301+
->method('getItemsQty')
302+
->willReturn(1);
269303
$quote->expects($this->any())
270304
->method('getBillingAddress')
271305
->willReturn($quoteBillingAddress);

app/code/Magento/Cms/Block/Adminhtml/Wysiwyg/Images/Tree.php

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
class Tree extends \Magento\Backend\Block\Template
1515
{
1616
/**
17-
* Core registry
18-
*
1917
* @var \Magento\Framework\Registry
2018
*/
2119
protected $_coreRegistry = null;
2220

2321
/**
24-
* Cms wysiwyg images
25-
*
2622
* @var \Magento\Cms\Helper\Wysiwyg\Images
2723
*/
2824
protected $_cmsWysiwygImages = null;
@@ -78,9 +74,9 @@ public function getTreeJson()
7874
];
7975
$hasNestedDirectories = $this->hasNestedDirectories($storageRoot, $item->getFilename());
8076

81-
// if no nested directories inside dir, add 'leaf' state so that jstree hides dropdown arrow next to dir
82-
if (!$hasNestedDirectories) {
83-
$data['state'] = 'leaf';
77+
// Display node as closed and enable lazy loading
78+
if ($hasNestedDirectories) {
79+
$data['children'] = true;
8480
}
8581

8682
$jsonArray[] = $data;

app/code/Magento/Cms/Test/Mftf/Section/TinyMCESection/MediaGallerySection.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<element name="confirmDelete" type="button" selector=".action-primary.action-accept"/>
3838
<element name="imageBlockByName" type="block" selector="//div[@data-row='file'][contains(., '{{imageName}}')]" parameterized="true"/>
3939
<element name="insertEditImageModalWindow" type="block" selector=".mce-floatpanel.mce-window[aria-label='Insert/edit image']"/>
40-
<element name="mediaGalleryFolderTreeIconCollapsed" type="button" parameterized="true" selector="//a[text()='{{folderName}}']/parent::li[contains(@class,'jstree-closed')]/ins"/>
41-
<element name="mediaGalleryFolderTreeIconExpanded" type="button" parameterized="true" selector="//a[text()='{{folderName}}']/parent::li[contains(@class,'jstree-open')]/ins"/>
40+
<element name="mediaGalleryFolderTreeIconCollapsed" type="button" parameterized="true" selector="//li[a[text()='{{folderName}}' and @aria-expanded='false']]/i"/>
41+
<element name="mediaGalleryFolderTreeIconExpanded" type="button" parameterized="true" selector="//li[a[text()='{{folderName}}' and @aria-expanded='true']]/i"/>
4242
</section>
4343
</sections>

0 commit comments

Comments
 (0)