Skip to content

Commit 5331375

Browse files
author
Mohan Ahuja
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-726
2 parents 3432e51 + 0953fe7 commit 5331375

File tree

33 files changed

+953
-378
lines changed

33 files changed

+953
-378
lines changed

app/code/Magento/Analytics/Model/ExportDataHandler.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
use Magento\Framework\App\Filesystem\DirectoryList;
1010
use Magento\Framework\Archive;
11+
use Magento\Framework\Exception\FileSystemException;
1112
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\Filesystem;
1314
use Magento\Framework\Filesystem\Directory\WriteInterface;
@@ -89,8 +90,7 @@ public function __construct(
8990
public function prepareExportData()
9091
{
9192
try {
92-
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::SYS_TMP);
93-
93+
$tmpDirectory = $this->filesystem->getDirectoryWrite(DirectoryList::TMP);
9494
$this->prepareDirectory($tmpDirectory, $this->getTmpFilesDirRelativePath());
9595
$this->reportWriter->write($tmpDirectory, $this->getTmpFilesDirRelativePath());
9696

@@ -106,8 +106,10 @@ public function prepareExportData()
106106
$this->cryptographer->encode($tmpDirectory->readFile($this->getArchiveRelativePath()))
107107
);
108108
} finally {
109-
$tmpDirectory->delete($this->getTmpFilesDirRelativePath());
110-
$tmpDirectory->delete($this->getArchiveRelativePath());
109+
if (isset($tmpDirectory)) {
110+
$tmpDirectory->delete($this->getTmpFilesDirRelativePath());
111+
$tmpDirectory->delete($this->getArchiveRelativePath());
112+
}
111113
}
112114

113115
return true;

app/code/Magento/Analytics/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Magento_Analytics module
22

3-
The Magento_Analytics module integrates your Magento instance with the [Magento Business Intelligence (MBI)](https://magento.com/products/business-intelligence) to use [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html) functionality.
3+
The Magento_Analytics module integrates your Magento instance with the [Magento Business Intelligence (MBI)](https://business.adobe.com/products/magento/business-intelligence.html) to use [Advanced Reporting](https://devdocs.magento.com/guides/v2.4/advanced-reporting/modules.html) functionality.
44

55
The module implements the following functionality:
66

app/code/Magento/Analytics/Test/Unit/Model/ExportDataHandlerTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
use Magento\Framework\Archive;
1616
use Magento\Framework\Filesystem;
1717
use Magento\Framework\Filesystem\Directory\WriteInterface;
18-
use Magento\Framework\Filesystem\DirectoryList;
18+
use Magento\Framework\App\Filesystem\DirectoryList;
1919
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper;
2020
use PHPUnit\Framework\MockObject\MockObject;
2121
use PHPUnit\Framework\TestCase;
@@ -127,7 +127,7 @@ public function testPrepareExportData($isArchiveSourceDirectory)
127127
$this->filesystemMock
128128
->expects($this->once())
129129
->method('getDirectoryWrite')
130-
->with(DirectoryList::SYS_TMP)
130+
->with(DirectoryList::TMP)
131131
->willReturn($this->directoryMock);
132132
$this->directoryMock
133133
->expects($this->exactly(4))
@@ -228,7 +228,7 @@ public function testPrepareExportDataWithLocalizedException()
228228
$this->filesystemMock
229229
->expects($this->once())
230230
->method('getDirectoryWrite')
231-
->with(DirectoryList::SYS_TMP)
231+
->with(DirectoryList::TMP)
232232
->willReturn($this->directoryMock);
233233
$this->reportWriterMock
234234
->expects($this->once())

app/code/Magento/Backend/Test/Mftf/Section/AdminSystemAccountSection.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,8 @@
1111
<section name="AdminSystemAccountSection">
1212
<element name="interfaceLocale" type="select" selector="#interface_locale"/>
1313
<element name="currentPassword" type="text" selector="#current_password"/>
14+
<element name="username" type="text" selector="#username"/>
15+
<element name="newPassword" type="text" selector="#password"/>
16+
<element name="passwordConfirmation" type="text" selector="#confirmation"/>
1417
</section>
1518
</sections>

app/code/Magento/Backend/etc/menu.xsd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<xs:simpleType name="typeId">
8686
<xs:annotation>
8787
<xs:documentation>
88-
Item id attribute can has only [a-z0-9/_]. Minimal length 3 symbol. Case insensitive.
88+
Item id attribute can have only [a-z0-9/_]. Minimal length 3 characters. Case insensitive.
8989
</xs:documentation>
9090
</xs:annotation>
9191
<xs:restriction base="xs:string">
@@ -96,7 +96,7 @@
9696
<xs:simpleType name="typeAction">
9797
<xs:annotation>
9898
<xs:documentation>
99-
Item action attribute can has only [a-zA-Z0-9/_]. Minimal length 3 symbol
99+
Item action attribute can have only [a-zA-Z0-9/_]. Minimal length 3 characters.
100100
</xs:documentation>
101101
</xs:annotation>
102102
<xs:restriction base="xs:string">
@@ -107,7 +107,7 @@
107107
<xs:simpleType name="typeTitle">
108108
<xs:annotation>
109109
<xs:documentation>
110-
Item title attribute minimal length 3 symbol
110+
Item title attribute minimal length 3 characters.
111111
</xs:documentation>
112112
</xs:annotation>
113113
<xs:restriction base="xs:string">
@@ -119,7 +119,7 @@
119119
<xs:simpleType name="typeModule">
120120
<xs:annotation>
121121
<xs:documentation>
122-
Item module attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
122+
Item module attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
123123
</xs:documentation>
124124
</xs:annotation>
125125
<xs:restriction base="xs:string">
@@ -130,7 +130,7 @@
130130
<xs:simpleType name="typeResource">
131131
<xs:annotation>
132132
<xs:documentation>
133-
Item resource attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
133+
Item resource attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
134134
</xs:documentation>
135135
</xs:annotation>
136136
<xs:restriction base="xs:string">
@@ -141,7 +141,7 @@
141141
<xs:simpleType name="typeDependsConfig">
142142
<xs:annotation>
143143
<xs:documentation>
144-
Item resource attribute can has only [a-z0-9_]. Minimal length 3 symbol. Case insensitive.
144+
Item dependsOnConfig attribute can have only [a-z0-9_]. Minimal length 3 characters. Case insensitive.
145145
</xs:documentation>
146146
</xs:annotation>
147147
<xs:restriction base="xs:string">

app/code/Magento/Catalog/Model/Product/Option/SaveHandler.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
use Magento\Catalog\Api\Data\ProductInterface;
1212
use Magento\Catalog\Api\ProductCustomOptionRepositoryInterface as OptionRepository;
1313
use Magento\Catalog\Model\Product\Option;
14+
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1415
use Magento\Framework\App\ObjectManager;
1516
use Magento\Framework\EntityManager\Operation\ExtensionInterface;
16-
use Magento\Catalog\Model\ResourceModel\Product\Relation;
1717
use Magento\Framework\Exception\CouldNotSaveException;
1818

1919
/**
@@ -26,12 +26,12 @@ class SaveHandler implements ExtensionInterface
2626
/**
2727
* @var string[]
2828
*/
29-
private $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
29+
private array $compositeProductTypes = ['grouped', 'configurable', 'bundle'];
3030

3131
/**
3232
* @var OptionRepository
3333
*/
34-
protected $optionRepository;
34+
protected OptionRepository $optionRepository;
3535

3636
/**
3737
* @var Relation
@@ -44,7 +44,7 @@ class SaveHandler implements ExtensionInterface
4444
*/
4545
public function __construct(
4646
OptionRepository $optionRepository,
47-
?Relation $relation = null
47+
?Relation $relation = null
4848
) {
4949
$this->optionRepository = $optionRepository;
5050
$this->relation = $relation ?: ObjectManager::getInstance()->get(Relation::class);
@@ -57,6 +57,7 @@ public function __construct(
5757
* @param array $arguments
5858
* @return ProductInterface|object
5959
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
60+
* @throws CouldNotSaveException
6061
*/
6162
public function execute($entity, $arguments = [])
6263
{
@@ -122,12 +123,11 @@ private function processOptionsSaving(array $options, bool $hasChangedSku, Produ
122123
private function isProductHasRelations(ProductInterface $product): bool
123124
{
124125
$result = true;
125-
if (!in_array($product->getId(), $this->compositeProductTypes)
126+
if (!in_array($product->getTypeId(), $this->compositeProductTypes)
126127
&& $this->relation->getRelationsByChildren([$product->getId()])
127128
) {
128129
$result = false;
129130
}
130-
131131
return $result;
132132
}
133133
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="AdminCreateTwoSimpleProductTest">
11+
<annotations>
12+
<stories value="Check Misleading message for guest customer on checkout"/>
13+
<title value="Admin should be able to check Misleading message for guest customer on checkout"/>
14+
<description value="Admin should be able to check Misleading message for guest customer on checkout"/>
15+
<testCaseId value="MC-36852"/>
16+
<severity value="MAJOR"/>
17+
<group value="product"/>
18+
</annotations>
19+
<before>
20+
<createData entity="ApiCategory" stepKey="createCategory"/>
21+
<createData entity="_defaultProduct" stepKey="createSimpleProduct">
22+
<requiredEntity createDataKey="createCategory"/>
23+
</createData>
24+
<createData entity="SimpleProduct" stepKey="createSimpleProduct2">
25+
<requiredEntity createDataKey="createCategory"/>
26+
</createData>
27+
<createData entity="Simple_US_Customer" stepKey="createCustomer"/>
28+
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin1"/>
29+
</before>
30+
<after>
31+
<deleteData createDataKey="createCategory" stepKey="deletePreReqCategory"/>
32+
<actionGroup ref="DeleteProductBySkuActionGroup" stepKey="deleteProduct">
33+
<argument name="sku" value="{{_defaultProduct.sku}}"/>
34+
</actionGroup>
35+
<actionGroup ref="AdminDeleteCustomerActionGroup" stepKey="deleteCustomer">
36+
<argument name="customerEmail" value="Simple_US_Customer.email"/>
37+
</actionGroup>
38+
<actionGroup ref="ClearFiltersAdminDataGridActionGroup" stepKey="clearFilter"/>
39+
<actionGroup ref="AdminLogoutActionGroup" stepKey="logoutOfAdmin"/>
40+
</after>
41+
42+
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStoreFront"/>
43+
<waitForPageLoad stepKey="waitForProductPage"/>
44+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductToCart">
45+
<argument name="product" value="$createSimpleProduct$"/>
46+
</actionGroup>
47+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart"/>
48+
<actionGroup ref="FillGuestCheckoutShippingAddressFormActionGroup" stepKey="goToShippingAndFillDetails"/>
49+
<selectOption selector="{{CheckoutCartSummarySection.stateProvince}}" userInput="Texas" stepKey="fillState2"/>
50+
<waitForPageLoad stepKey="waitForProductPage1"/>
51+
<actionGroup ref="StorefrontSetShippingMethodActionGroup" stepKey="setShippingMethodFreeShipping">
52+
<argument name="shippingMethodName" value="Flat Rate"/>
53+
</actionGroup>
54+
<actionGroup ref="StorefrontCheckoutClickNextOnShippingStepActionGroup" stepKey="goToCheckoutReview"/>
55+
<actionGroup ref="StorefrontClickOnHeaderLogoActionGroup" stepKey="clickOnStorefrontHeaderLogo"/>
56+
<actionGroup ref="AddSimpleProductToCartActionGroup" stepKey="addSimpleProductTwoToCart">
57+
<argument name="product" value="$createSimpleProduct2$"/>
58+
</actionGroup>
59+
<actionGroup ref="GoToCheckoutFromMinicartActionGroup" stepKey="goToCheckoutFromMinicart2"/>
60+
<actionGroup ref="AssertStorefrontEmailNoteMessageOnCheckoutActionGroup" stepKey="assertEmailNoteMessage"/>
61+
</test>
62+
</tests>

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ $_helper = $block->getData('outputHelper');
8686
<form data-role="tocart-form"
8787
data-product-sku="<?= $escaper->escapeHtml($_product->getSku()) ?>"
8888
action="<?= $escaper->escapeUrl($postParams['action']) ?>"
89+
data-mage-init='{"catalogAddToCart": {}}'
8990
method="post">
9091
<?php $options = $block->getData('viewModel')->getOptionsData($_product); ?>
9192
<?php foreach ($options as $optionItem): ?>
@@ -161,13 +162,4 @@ $_helper = $block->getData('outputHelper');
161162
</div>
162163
<?= $block->getChildBlock('toolbar')->setIsBottom(true)->toHtml() ?>
163164
<?php // phpcs:ignore Magento2.Legacy.PhtmlTemplate ?>
164-
<script type="text/x-magento-init">
165-
{
166-
"[data-role=tocart-form], .form.map.checkout": {
167-
"catalogAddToCart": {
168-
"product_sku": "<?= $escaper->escapeJs($_product->getSku()) ?>"
169-
}
170-
}
171-
}
172-
</script>
173165
<?php endif; ?>

app/code/Magento/Checkout/view/frontend/web/js/view/form/element/email.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ define([
5353
isCustomerLoggedIn: customer.isLoggedIn,
5454
forgotPasswordUrl: window.checkoutConfig.forgotPasswordUrl,
5555
emailCheckTimeout: 0,
56+
emailInputId: '#customer-email',
5657

5758
/**
5859
* Initializes regular properties of instance.
@@ -108,6 +109,8 @@ define([
108109
checkEmailAvailability: function () {
109110
this.validateRequest();
110111
this.isEmailCheckComplete = $.Deferred();
112+
// Clean up errors on email
113+
$(this.emailInputId).removeClass('mage-error').parent().find('.mage-error').remove();
111114
this.isLoading(true);
112115
this.checkRequest = checkEmailAvailability(this.isEmailCheckComplete, this.email());
113116

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
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+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
9+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
10+
<test name="StorefrontCustomerAddressSecurityTest">
11+
<annotations>
12+
<features value="Customer address"/>
13+
<stories value="other customer can not access the address of another customer"/>
14+
<title value="Customer address can't be overwritten or access by other customer"/>
15+
<description value="Customer address can't be overwritten [security]"/>
16+
<severity value="MAJOR"/>
17+
<testCaseId value="MC-27518"/>
18+
<group value="customer"/>
19+
<group value="create"/>
20+
</annotations>
21+
<before>
22+
<createData entity="Simple_US_Customer" stepKey="createFirstCustomer"/>
23+
<createData entity="Simple_Customer_Without_Address" stepKey="createSecondCustomer"/>
24+
</before>
25+
26+
<after>
27+
<deleteData createDataKey="createFirstCustomer" stepKey="DeleteFirstCustomer"/>
28+
<deleteData createDataKey="createSecondCustomer" stepKey="DeleteSecondCustomer"/>
29+
</after>
30+
31+
<!--Log in to Storefront as First Customer -->
32+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginFirstCustomer">
33+
<argument name="Customer" value="$$createFirstCustomer$$"/>
34+
</actionGroup>
35+
<actionGroup ref="StorefrontGoToCustomerAddressesPageActionGroup" stepKey="goToCustomerAddressBook1"/>
36+
<click stepKey="ClickEditDefaultBillingAddress" selector="{{StorefrontCustomerAddressesSection.editDefaultBillingAddress}}"/>
37+
<grabFromCurrentUrl stepKey="grabCurrentAddressUrl"/>
38+
<actionGroup ref="StorefrontCustomerLogoutActionGroup" stepKey="logoutFirstCustomer"/>
39+
40+
<!--Log in to Storefront as Second Customer -->
41+
<actionGroup ref="LoginToStorefrontActionGroup" stepKey="loginSecondCustomer">
42+
<argument name="Customer" value="$$createSecondCustomer$$"/>
43+
</actionGroup>
44+
<amOnPage url="$grabCurrentAddressUrl" stepKey="OpenCustomerAddNewAddress"/>
45+
46+
<grabAttributeFrom userInput="value" selector="{{StorefrontCustomerAddressFormSection.firstName}}" stepKey="grabFirstName"/>
47+
<grabAttributeFrom userInput="value" selector="{{StorefrontCustomerAddressFormSection.lastName}}" stepKey="grabLastName"/>
48+
<assertEquals message="verify first name from element value" stepKey="assertFirstName">
49+
<expectedResult type="string">$$createSecondCustomer.firstname$$</expectedResult>
50+
<actualResult type="string">$grabFirstName</actualResult>
51+
</assertEquals>
52+
<assertEquals message="verify last name from element value" stepKey="assertLastName">
53+
<expectedResult type="string">$$createSecondCustomer.lastname$$</expectedResult>
54+
<actualResult type="string">$grabLastName</actualResult>
55+
</assertEquals>
56+
</test>
57+
</tests>

0 commit comments

Comments
 (0)