Skip to content

Commit 6330e85

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento/magento2ce into B2B-2081
2 parents e1241f8 + 7431f26 commit 6330e85

File tree

8 files changed

+53
-6
lines changed

8 files changed

+53
-6
lines changed

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/Customer/view/adminhtml/web/template/default-address.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<div data-bind="attr: {class: contentClass}">
88
<div data-bind="attr: {class: 'fieldset-wrapper address-information ' + defaultAddressClass}">
99
<address>
10-
<div class="address_caption">
10+
<div class="address_caption" data-bind="attr: {id: defaultAddressId}">
1111
<text args="title"></text>
1212
<each args="data: elems, as: 'element'">
1313
<render if="hasTemplate()"></render>

app/code/Magento/Customer/view/base/ui_component/customer_form.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@
348348
<argument name="data" xsi:type="array">
349349
<item name="config" xsi:type="array">
350350
<item name="defaultAddressClass" xsi:type="string">billing-address</item>
351+
<item name="defaultAddressId" xsi:type="string">billing-address-caption</item>
351352
<item name="title" translate="true" xsi:type="string">Default Billing Address</item>
352353
<item name="contentClass" xsi:type="string">customer-default-billing-address-content</item>
353354
<item name="notExistsMessage" xsi:type="string" translate="true">The customer does not have default billing address</item>
@@ -366,6 +367,8 @@
366367
<argument name="data" xsi:type="array">
367368
<item name="config" xsi:type="array">
368369
<item name="buttonClasses" xsi:type="string">edit-default-billing-address-button</item>
370+
<item name="buttonTextId" xsi:type="string">edit-billing-address</item>
371+
<item name="ariLabelledby" xsi:type="string">billing-address-caption edit-billing-address</item>
369372
<item name="actions" xsi:type="array">
370373
<item name="0" xsi:type="array">
371374
<item name="targetName" xsi:type="string">customer_form.areas.address.address.customer_address_update_modal.update_customer_address_form_loader</item>
@@ -398,6 +401,7 @@
398401
<argument name="data" xsi:type="array">
399402
<item name="config" xsi:type="array">
400403
<item name="defaultAddressClass" xsi:type="string">shipping-address</item>
404+
<item name="defaultAddressId" xsi:type="string">shipping-address-caption</item>
401405
<item name="title" xsi:type="string" translate="true">Default Shipping Address</item>
402406
<item name="contentClass" xsi:type="string">customer-default-shipping-address-content</item>
403407
<item name="notExistsMessage" xsi:type="string" translate="true">The customer does not have default shipping address</item>
@@ -416,6 +420,8 @@
416420
<argument name="data" xsi:type="array">
417421
<item name="config" xsi:type="array">
418422
<item name="buttonClasses" xsi:type="string">edit-default-shipping-address-button</item>
423+
<item name="buttonTextId" xsi:type="string">edit-shipping-address</item>
424+
<item name="ariLabelledby" xsi:type="string">shipping-address-caption edit-shipping-address</item>
419425
<item name="actions" xsi:type="array">
420426
<item name="0" xsi:type="array">
421427
<item name="targetName" xsi:type="string">customer_form.areas.address.address.customer_address_update_modal.update_customer_address_form_loader</item>

app/code/Magento/Ui/view/base/web/js/form/components/button.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ define([
2525
template: 'ui/form/components/button/simple',
2626
visible: true,
2727
disabled: false,
28-
title: ''
28+
title: '',
29+
buttonTextId: '',
30+
ariLabelledby: ''
2931
},
3032

3133
/**

app/code/Magento/Ui/view/base/web/templates/form/element/button.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
css="buttonClasses"
99
click="action"
1010
disable="disabled"
11-
attr="'data-index': index">
12-
<span text="title"></span>
11+
attr="'data-index': index, 'aria-labelledby': ariLabelledby">
12+
<span attr="'id': buttonTextId" text="title"></span>
1313
</button>
1414

1515
<if args="childError">

app/code/Magento/Ui/view/base/web/templates/form/element/date.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@
1313
name: inputName,
1414
placeholder: placeholder,
1515
'aria-describedby': noticeId,
16-
disabled: disabled
16+
disabled: disabled,
17+
id:uid
1718
}" />

setup/src/Magento/Setup/Module/Di/Code/Scanner/PhpScanner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ private function findMissingFactories($file, $classReflection, $methodName, $ent
6262
$parameters = $constructor->getParameters();
6363
/** @var $parameter \ReflectionParameter */
6464
foreach ($parameters as $parameter) {
65-
preg_match('/\[\s\<\w+?>\s([\w\\\\]+)/s', $parameter->__toString(), $matches);
65+
preg_match('/\[\s\<\w+?>\s\??([\w\\\\]+)/s', $parameter->__toString(), $matches);
6666
if (isset($matches[1]) && substr($matches[1], -strlen($entityType)) == $entityType) {
6767
$missingClassName = $matches[1];
6868
if ($this->shouldGenerateClass($missingClassName, $entityType, $file)) {

0 commit comments

Comments
 (0)