diff --git a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
index 56713c0c6f300..6105291ec82a3 100644
--- a/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
+++ b/app/code/Magento/Catalog/view/adminhtml/web/js/custom-options.js
@@ -177,7 +177,7 @@ define([
'products[]': request,
'form_key': widget.options.formKey
}, function ($data) {
- $.parseJSON($data).each(function (el) {
+ $.each(JSON.parse($data), function (el) {
var i;
el.id = widget.getFreeOptionId(el.id);
diff --git a/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js b/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js
index e3f5e04bdcb1b..886963db67480 100644
--- a/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js
+++ b/app/code/Magento/Catalog/view/frontend/web/js/storage-manager.js
@@ -233,6 +233,7 @@ define([
delete params.typeId;
delete params.url;
+ this.requestSent = 1;
return utils.ajaxSubmit({
url: url,
diff --git a/app/code/Magento/CatalogAnalytics/composer.json b/app/code/Magento/CatalogAnalytics/composer.json
index 21c8f9be01dd2..9556c28820b62 100644
--- a/app/code/Magento/CatalogAnalytics/composer.json
+++ b/app/code/Magento/CatalogAnalytics/composer.json
@@ -2,7 +2,7 @@
"name": "magento/module-catalog-analytics",
"description": "N/A",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-analytics": "*"
diff --git a/app/code/Magento/CatalogCmsGraphQl/composer.json b/app/code/Magento/CatalogCmsGraphQl/composer.json
index f7ef342c06520..1a245039b241a 100644
--- a/app/code/Magento/CatalogCmsGraphQl/composer.json
+++ b/app/code/Magento/CatalogCmsGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-cms-graph-ql": "*"
diff --git a/app/code/Magento/CatalogCustomerGraphQl/composer.json b/app/code/Magento/CatalogCustomerGraphQl/composer.json
index baa393009ae19..f824dcb9e658c 100644
--- a/app/code/Magento/CatalogCustomerGraphQl/composer.json
+++ b/app/code/Magento/CatalogCustomerGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-customer": "*",
diff --git a/app/code/Magento/CatalogGraphQl/composer.json b/app/code/Magento/CatalogGraphQl/composer.json
index fe7725da5d2b9..99e847b6d1745 100644
--- a/app/code/Magento/CatalogGraphQl/composer.json
+++ b/app/code/Magento/CatalogGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-eav": "*",
"magento/module-catalog": "*",
"magento/module-catalog-inventory": "*",
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
index b2eca68db4d1c..d8415591cb163 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Product/Validator.php
@@ -205,7 +205,7 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
return $valid;
}
- if (!strlen(trim($rowData[$attrCode]))) {
+ if ($rowData[$attrCode] === null || trim($rowData[$attrCode]) === '') {
return true;
}
@@ -213,6 +213,7 @@ public function isAttributeValid($attrCode, array $attrParams, array $rowData)
return true;
}
+ $valid = false;
switch ($attrParams['type']) {
case 'varchar':
case 'text':
diff --git a/app/code/Magento/CatalogImportExport/Model/Import/Uploader.php b/app/code/Magento/CatalogImportExport/Model/Import/Uploader.php
index d2a0019349ef2..6761663502604 100644
--- a/app/code/Magento/CatalogImportExport/Model/Import/Uploader.php
+++ b/app/code/Magento/CatalogImportExport/Model/Import/Uploader.php
@@ -7,6 +7,8 @@
use Magento\Framework\App\Filesystem\DirectoryList;
use Magento\Framework\App\ObjectManager;
+use Magento\Framework\Exception\FileSystemException;
+use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\ValidatorException;
use Magento\Framework\Filesystem;
use Magento\Framework\Filesystem\Directory\TargetDirectory;
@@ -56,18 +58,14 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
'png' => 'image/png',
];
- const DEFAULT_FILE_TYPE = 'application/octet-stream';
+ public const DEFAULT_FILE_TYPE = 'application/octet-stream';
/**
- * Image factory.
- *
* @var \Magento\Framework\Image\AdapterFactory
*/
protected $_imageFactory;
/**
- * Validator.
- *
* @var \Magento\MediaStorage\Model\File\Validator\NotProtectedExtension
*/
protected $_validator;
@@ -114,6 +112,8 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
/**
* Directory and filename must be no more than 255 characters in length
+ *
+ * @var int
*/
private $maxFilenameLength = 255;
@@ -132,8 +132,8 @@ class Uploader extends \Magento\MediaStorage\Model\File\Uploader
* @param string|null $filePath
* @param \Magento\Framework\Math\Random|null $random
* @param TargetDirectory|null $targetDirectory
- * @throws \Magento\Framework\Exception\FileSystemException
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws FileSystemException
+ * @throws LocalizedException
*/
public function __construct(
\Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDb,
@@ -182,7 +182,7 @@ public function init()
* @param string $fileName
* @param bool $renameFileOff
* @return array
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function move($fileName, $renameFileOff = false)
{
@@ -197,17 +197,20 @@ public function move($fileName, $renameFileOff = false)
}
$this->_setUploadFile($tmpFilePath);
- $rootDirectory = $this->getTargetDirectory()->getDirectoryRead(DirectoryList::ROOT);
+ $rootDirectory = $this->targetDirectory->getDirectoryRead(DirectoryList::ROOT);
$destDir = $rootDirectory->getAbsolutePath($this->getDestDir());
$result = $this->save($destDir);
- unset($result['path']);
- $result['name'] = self::getCorrectFileName($result['name']);
- // Directory and filename must be no more than 255 characters in length
- if (strlen($result['file']) > $this->maxFilenameLength) {
- throw new \LengthException(
- __('Filename is too long; must be %1 characters or less', $this->maxFilenameLength)
- );
+ if (\is_array($result)) {
+ unset($result['path']);
+ $result['name'] = self::getCorrectFileName($result['name']);
+
+ // Directory and filename must be no more than 255 characters in length
+ if (strlen($result['file']) > $this->maxFilenameLength) {
+ throw new \LengthException(
+ __('Filename is too long; must be %1 characters or less', $this->maxFilenameLength)
+ );
+ }
}
return $result;
@@ -219,29 +222,30 @@ public function move($fileName, $renameFileOff = false)
* @param string $url
* @param string $driver
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
private function downloadFileFromUrl($url, $driver)
{
$parsedUrlPath = parse_url($url, PHP_URL_PATH);
+
if (!$parsedUrlPath) {
- throw new \Magento\Framework\Exception\LocalizedException(__('Could not parse resource url.'));
+ throw new LocalizedException(__('Could not parse resource url.'));
}
$urlPathValues = explode('/', $parsedUrlPath);
$fileName = preg_replace('/[^a-z0-9\._-]+/i', '', end($urlPathValues));
-
+ //phpcs:ignore Magento2.Functions.DiscouragedFunction
$fileExtension = pathinfo($fileName, PATHINFO_EXTENSION);
+
if ($fileExtension && !$this->checkAllowedExtension($fileExtension)) {
- throw new \Magento\Framework\Exception\LocalizedException(__('Disallowed file type.'));
+ throw new LocalizedException(__('Disallowed file type.'));
}
-
$tmpFileName = str_replace(".$fileExtension", '', $fileName);
$tmpFileName .= '_' . $this->random->getRandomString(16);
$tmpFileName .= $fileExtension ? ".$fileExtension" : '';
$tmpFilePath = $this->_directory->getRelativePath($this->getTempFilePath($tmpFileName));
if (!$this->_directory->isWritable($this->getTmpDir())) {
- throw new \Magento\Framework\Exception\LocalizedException(
+ throw new LocalizedException(
__('Import images directory must be writable in order to process remote images.')
);
}
@@ -253,26 +257,12 @@ private function downloadFileFromUrl($url, $driver)
return $tmpFilePath;
}
- /**
- * Retrieves target directory.
- *
- * @return TargetDirectory
- */
- private function getTargetDirectory(): TargetDirectory
- {
- if (!isset($this->targetDirectory)) {
- $this->targetDirectory = ObjectManager::getInstance()->get(TargetDirectory::class);
- }
-
- return $this->targetDirectory;
- }
-
/**
* Prepare information about the file for moving
*
* @param string $filePath
* @return void
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
protected function _setUploadFile($filePath)
{
@@ -290,7 +280,7 @@ protected function _setUploadFile($filePath)
$readable = false;
}
if (!$readable) {
- throw new \Magento\Framework\Exception\LocalizedException(
+ throw new LocalizedException(
__('File \'%1\' was not found or has read restriction.', $filePath)
);
}
@@ -322,7 +312,7 @@ protected function _readFileInfo($filePath)
* Validate uploaded file by type and etc.
*
* @return void
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
protected function _validateFile()
{
@@ -335,7 +325,7 @@ protected function _validateFile()
$fileExtension = pathinfo($filePath, PATHINFO_EXTENSION);
if (!$this->checkAllowedExtension($fileExtension)) {
- throw new \Magento\Framework\Exception\LocalizedException(__('Disallowed file type.'));
+ throw new LocalizedException(__('Disallowed file type.'));
}
//run validate callbacks
foreach ($this->_validateCallbacks as $params) {
@@ -405,7 +395,7 @@ public function getDestDir()
*/
public function setDestDir($path)
{
- $directoryRoot = $this->getTargetDirectory()->getDirectoryWrite(DirectoryList::ROOT);
+ $directoryRoot = $this->targetDirectory->getDirectoryWrite(DirectoryList::ROOT);
if (is_string($path) && $directoryRoot->isWritable($path)) {
$this->_destDir = $path;
return true;
@@ -429,7 +419,7 @@ protected function _moveFile($tmpPath, $destPath)
$destinationRealPath = $this->_directory->getDriver()->getRealPath($destPath);
$relativeDestPath = $this->_directory->getRelativePath($destPath);
$isSameFile = $tmpRealPath === $destinationRealPath;
- $rootDirectory = $this->getTargetDirectory()->getDirectoryWrite(DirectoryList::ROOT);
+ $rootDirectory = $this->targetDirectory->getDirectoryWrite(DirectoryList::ROOT);
return $isSameFile ?: $this->_directory->copyFile($tmpPath, $relativeDestPath, $rootDirectory);
} else {
return false;
diff --git a/app/code/Magento/CatalogImportExport/composer.json b/app/code/Magento/CatalogImportExport/composer.json
index 663c207f5790b..0efd8e8b36f1c 100644
--- a/app/code/Magento/CatalogImportExport/composer.json
+++ b/app/code/Magento/CatalogImportExport/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"ext-ctype": "*",
"magento/framework": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogInventory/composer.json b/app/code/Magento/CatalogInventory/composer.json
index b0cfa00e36059..e3cdc9e014c90 100644
--- a/app/code/Magento/CatalogInventory/composer.json
+++ b/app/code/Magento/CatalogInventory/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-config": "*",
diff --git a/app/code/Magento/CatalogInventoryGraphQl/composer.json b/app/code/Magento/CatalogInventoryGraphQl/composer.json
index d0e015d389f98..5c9e8f55c000b 100644
--- a/app/code/Magento/CatalogInventoryGraphQl/composer.json
+++ b/app/code/Magento/CatalogInventoryGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-store": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
index 9d1a23611dc27..7d9553c9cc02f 100644
--- a/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
+++ b/app/code/Magento/CatalogRule/Block/Adminhtml/Promo/Catalog/Edit/Tab/Conditions.php
@@ -5,15 +5,15 @@
*/
namespace Magento\CatalogRule\Block\Adminhtml\Promo\Catalog\Edit\Tab;
-use Magento\Backend\Block\Widget\Form;
use Magento\Backend\Block\Widget\Form\Generic;
+use Magento\Backend\Block\Widget\Form\Renderer\Fieldset;
use Magento\Ui\Component\Layout\Tabs\TabInterface;
use Magento\Rule\Model\Condition\AbstractCondition;
class Conditions extends Generic implements TabInterface
{
/**
- * @var \Magento\Backend\Block\Widget\Form\Renderer\Fieldset
+ * @var Fieldset
*/
protected $_rendererFieldset;
@@ -27,7 +27,7 @@ class Conditions extends Generic implements TabInterface
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
* @param \Magento\Rule\Block\Conditions $conditions
- * @param \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset
+ * @param Fieldset $rendererFieldset
* @param array $data
*/
public function __construct(
@@ -35,7 +35,7 @@ public function __construct(
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Magento\Rule\Block\Conditions $conditions,
- \Magento\Backend\Block\Widget\Form\Renderer\Fieldset $rendererFieldset,
+ Fieldset $rendererFieldset,
array $data = []
) {
$this->_rendererFieldset = $rendererFieldset;
@@ -121,7 +121,7 @@ public function isAjaxLoaded()
}
/**
- * @return Form
+ * @inheritdoc
*/
protected function _prepareForm()
{
@@ -135,6 +135,8 @@ protected function _prepareForm()
}
/**
+ * Adds 'Conditions' to the form.
+ *
* @param \Magento\CatalogRule\Api\Data\RuleInterface $model
* @param string $fieldsetId
* @param string $formName
@@ -154,7 +156,8 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
['form_namespace' => $formName]
);
- $renderer = $this->_rendererFieldset->setTemplate('Magento_CatalogRule::promo/fieldset.phtml')
+ $renderer = $this->getLayout()->createBlock(Fieldset::class);
+ $renderer->setTemplate('Magento_CatalogRule::promo/fieldset.phtml')
->setNewChildUrl($newChildUrl)
->setFieldSetId($conditionsFieldSetId);
@@ -183,6 +186,8 @@ protected function addTabToForm($model, $fieldsetId = 'conditions_fieldset', $fo
}
/**
+ * Sets form name for Condition section.
+ *
* @param AbstractCondition $conditions
* @param string $formName
* @param string $jsFormName
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection/AdminCatalogPriceRuleGridSection.xml b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection/AdminCatalogPriceRuleGridSection.xml
index aeab4eb369b02..9fc5a364c27c1 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection/AdminCatalogPriceRuleGridSection.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Section/AdminNewCatalogPriceRuleSection/AdminCatalogPriceRuleGridSection.xml
@@ -15,5 +15,6 @@
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleByPercentTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleByPercentTest.xml
index 843bc4e722e65..ff04eded2f884 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleByPercentTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleByPercentTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleForCustomerGroupTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleForCustomerGroupTest.xml
index 95832cb38a834..ce8d2dd1507fb 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleForCustomerGroupTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminCreateCatalogPriceRuleTest/AdminCreateCatalogPriceRuleForCustomerGroupTest.xml
@@ -35,6 +35,10 @@
+
+
+
+
diff --git a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
index 333c4ab06aad1..58e266a0cb544 100644
--- a/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
+++ b/app/code/Magento/CatalogRule/Test/Mftf/Test/AdminDeleteCatalogPriceRuleTest.xml
@@ -48,8 +48,18 @@
-
-
+
+
+
+
+
+ {{AdminCatalogPriceRuleGrid.firstNotEmptyRow}}
+ {{AdminConfirmationModalSection.ok}}
+ {{AdminNewCatalogPriceRule.delete}}
+ {{AdminMessagesSection.success}}
+ You deleted the rule.
+
+
diff --git a/app/code/Magento/CatalogRule/composer.json b/app/code/Magento/CatalogRule/composer.json
index 7ebf62fd445cc..ab9e27c06d991 100644
--- a/app/code/Magento/CatalogRule/composer.json
+++ b/app/code/Magento/CatalogRule/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php
index d27c424ed9ea3..231696f259f59 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php
+++ b/app/code/Magento/CatalogRuleConfigurable/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandler.php
@@ -42,13 +42,26 @@ public function __construct(
}
/**
+ * Match configurable child products if configurable product match the condition
+ *
* @param \Magento\CatalogRule\Model\Rule $rule
- * @param array $productIds
+ * @param \Closure $proceed
* @return array
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
*/
- public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule, array $productIds)
- {
+ public function aroundGetMatchingProductIds(
+ \Magento\CatalogRule\Model\Rule $rule,
+ \Closure $proceed
+ ) {
+ $productsFilter = $rule->getProductsFilter() ? (array) $rule->getProductsFilter() : [];
+ if ($productsFilter) {
+ $parentProductIds = $this->configurable->getParentIdsByChild($productsFilter);
+ $rule->setProductsFilter(array_unique(array_merge($productsFilter, $parentProductIds)));
+ }
+
+ $productIds = $proceed();
+
$configurableProductIds = $this->configurableProductsProvider->getIds(array_keys($productIds));
foreach ($configurableProductIds as $productId) {
if (!isset($this->childrenProducts[$productId])) {
@@ -58,11 +71,15 @@ public function afterGetMatchingProductIds(\Magento\CatalogRule\Model\Rule $rule
$parentValidationResult = isset($productIds[$productId])
? array_filter($productIds[$productId])
: [];
+ $processAllChildren = !$productsFilter || in_array($productId, $productsFilter);
foreach ($subProductIds as $subProductId) {
- $childValidationResult = isset($productIds[$subProductId])
- ? array_filter($productIds[$subProductId])
- : [];
- $productIds[$subProductId] = $parentValidationResult + $childValidationResult;
+ if ($processAllChildren || in_array($subProductId, $productsFilter)) {
+ $childValidationResult = isset($productIds[$subProductId])
+ ? array_filter($productIds[$subProductId])
+ : [];
+ $productIds[$subProductId] = $parentValidationResult + $childValidationResult;
+ }
+
}
unset($productIds[$productId]);
}
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
index ca9017b7c5f29..a66d9b41f0f8a 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Mftf/Test/AdminApplyCatalogRuleForConfigurableProductWithAssignedSimpleProducts2Test.xml
@@ -175,7 +175,9 @@
-
+
+
+
diff --git a/app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php b/app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php
index 4d508853643ee..77c9904a22c6b 100644
--- a/app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php
+++ b/app/code/Magento/CatalogRuleConfigurable/Test/Unit/Plugin/CatalogRule/Model/Rule/ConfigurableProductHandlerTest.php
@@ -44,7 +44,7 @@ protected function setUp(): void
{
$this->configurableMock = $this->createPartialMock(
Configurable::class,
- ['getChildrenIds']
+ ['getChildrenIds', 'getParentIdsByChild']
);
$this->configurableProductsProviderMock = $this->createPartialMock(
ConfigurableProductsProvider::class,
@@ -61,22 +61,29 @@ protected function setUp(): void
/**
* @return void
*/
- public function testAfterGetMatchingProductIdsWithSimpleProduct()
+ public function testAroundGetMatchingProductIdsWithSimpleProduct()
{
$this->configurableProductsProviderMock->expects($this->once())->method('getIds')->willReturn([]);
$this->configurableMock->expects($this->never())->method('getChildrenIds');
+ $this->ruleMock->expects($this->never())
+ ->method('setProductsFilter');
$productIds = ['product' => 'valid results'];
$this->assertEquals(
$productIds,
- $this->configurableProductHandler->afterGetMatchingProductIds($this->ruleMock, $productIds)
+ $this->configurableProductHandler->aroundGetMatchingProductIds(
+ $this->ruleMock,
+ function () {
+ return ['product' => 'valid results'];
+ }
+ )
);
}
/**
* @return void
*/
- public function testAfterGetMatchingProductIdsWithConfigurableProduct()
+ public function testAroundGetMatchingProductIdsWithConfigurableProduct()
{
$this->configurableProductsProviderMock->expects($this->once())->method('getIds')
->willReturn(['conf1', 'conf2']);
@@ -84,6 +91,8 @@ public function testAfterGetMatchingProductIdsWithConfigurableProduct()
['conf1', true, [ 0 => ['simple1']]],
['conf2', true, [ 0 => ['simple1', 'simple2']]],
]);
+ $this->ruleMock->expects($this->never())
+ ->method('setProductsFilter');
$this->assertEquals(
[
@@ -96,21 +105,118 @@ public function testAfterGetMatchingProductIdsWithConfigurableProduct()
3 => true,
]
],
- $this->configurableProductHandler->afterGetMatchingProductIds(
+ $this->configurableProductHandler->aroundGetMatchingProductIds(
$this->ruleMock,
- [
- 'conf1' => [
- 0 => true,
- 1 => true,
- ],
- 'conf2' => [
- 0 => false,
- 1 => false,
- 3 => true,
- 4 => false,
- ],
- ]
+ function () {
+ return [
+ 'conf1' => [
+ 0 => true,
+ 1 => true,
+ ],
+ 'conf2' => [
+ 0 => false,
+ 1 => false,
+ 3 => true,
+ 4 => false,
+ ],
+ ];
+ }
)
);
}
+
+ /**
+ * @param array $productsFilter
+ * @param array $expectedProductsFilter
+ * @param array $matchingProductIds
+ * @param array $expectedMatchingProductIds
+ * @return void
+ * @dataProvider aroundGetMatchingProductIdsDataProvider
+ */
+ public function testAroundGetMatchingProductIdsWithProductsFilter(
+ array $productsFilter,
+ array $expectedProductsFilter,
+ array $matchingProductIds,
+ array $expectedMatchingProductIds
+ ): void {
+ $configurableProducts = [
+ 'conf1' => ['simple11', 'simple12'],
+ 'conf2' => ['simple21', 'simple22'],
+ ];
+ $this->configurableProductsProviderMock->method('getIds')
+ ->willReturnCallback(
+ function ($ids) use ($configurableProducts) {
+ return array_intersect($ids, array_keys($configurableProducts));
+ }
+ );
+ $this->configurableMock->method('getChildrenIds')
+ ->willReturnCallback(
+ function ($id) use ($configurableProducts) {
+ return [0 => $configurableProducts[$id] ?? []];
+ }
+ );
+
+ $this->configurableMock->method('getParentIdsByChild')
+ ->willReturnCallback(
+ function ($ids) use ($configurableProducts) {
+ $result = [];
+ foreach ($configurableProducts as $configurableProduct => $childProducts) {
+ if (array_intersect($ids, $childProducts)) {
+ $result[] = $configurableProduct;
+ }
+ }
+ return $result;
+ }
+ );
+
+ $this->ruleMock->method('getProductsFilter')
+ ->willReturn($productsFilter);
+
+ $this->ruleMock->expects($this->once())
+ ->method('setProductsFilter')
+ ->willReturn($expectedProductsFilter);
+
+ $this->assertEquals(
+ $expectedMatchingProductIds,
+ $this->configurableProductHandler->aroundGetMatchingProductIds(
+ $this->ruleMock,
+ function () use ($matchingProductIds) {
+ return $matchingProductIds;
+ }
+ )
+ );
+ }
+
+ /**
+ * @return array[]
+ */
+ public function aroundGetMatchingProductIdsDataProvider(): array
+ {
+ return [
+ [
+ ['simple1',],
+ ['simple1',],
+ ['simple1' => [1 => false]],
+ ['simple1' => [1 => false],],
+ ],
+ [
+ ['simple11',],
+ ['simple11', 'conf1',],
+ ['simple11' => [1 => false], 'conf1' => [1 => true],],
+ ['simple11' => [1 => true],],
+ ],
+ [
+ ['simple11', 'simple12',],
+ ['simple11', 'conf1',],
+ ['simple11' => [1 => false], 'conf1' => [1 => true],],
+ ['simple11' => [1 => true], 'simple12' => [1 => true],],
+ ],
+ [
+ ['conf1', 'simple11', 'simple12'],
+ ['conf1', 'simple11', 'simple12'],
+ ['conf1' => [1 => true], 'simple11' => [1 => false], 'simple12' => [1 => false]],
+ ['simple11' => [1 => true], 'simple12' => [1 => true]],
+ ],
+ ];
+ }
}
diff --git a/app/code/Magento/CatalogRuleConfigurable/composer.json b/app/code/Magento/CatalogRuleConfigurable/composer.json
index c427abc2d86fc..0c75f21ed9abc 100644
--- a/app/code/Magento/CatalogRuleConfigurable/composer.json
+++ b/app/code/Magento/CatalogRuleConfigurable/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/magento-composer-installer": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogRuleGraphQl/composer.json b/app/code/Magento/CatalogRuleGraphQl/composer.json
index 8d9514a0c2670..8527d9d49eb03 100644
--- a/app/code/Magento/CatalogRuleGraphQl/composer.json
+++ b/app/code/Magento/CatalogRuleGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*"
},
"suggest": {
diff --git a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
index 06dcc69ef60f5..9b66606d37a9e 100644
--- a/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
+++ b/app/code/Magento/CatalogSearch/Model/ResourceModel/Fulltext/Collection.php
@@ -177,8 +177,8 @@ public function __construct(
TotalRecordsResolverFactory $totalRecordsResolverFactory = null,
DefaultFilterStrategyApplyCheckerInterface $defaultFilterStrategyApplyChecker = null
) {
- $this->searchResultFactory = $searchResultFactory ?? \Magento\Framework\App\ObjectManager::getInstance()
- ->get(\Magento\Framework\Api\Search\SearchResultFactory::class);
+ $this->searchResultFactory = $searchResultFactory
+ ?? ObjectManager::getInstance()->get(SearchResultFactory::class);
parent::__construct(
$entityFactory,
$logger,
@@ -368,13 +368,12 @@ public function _loadEntities($printQuery = false, $logQuery = false)
$this->getEntity();
$this->printLogQuery($printQuery, $logQuery);
-
+ /**
+ * Prepare select query
+ * @var string $query
+ */
+ $query = $this->getSelect();
try {
- /**
- * Prepare select query
- * @var string $query
- */
- $query = $this->getSelect();
$rows = $this->_fetchAll($query);
} catch (\Exception $e) {
$this->printLogQuery(false, true, $query);
@@ -455,7 +454,7 @@ protected function _renderFiltersBefore()
}
if ($this->searchRequestName !== 'quick_search_container'
- || strlen(trim($this->queryText))
+ || ($this->queryText && strlen(trim($this->queryText)))
) {
$this->prepareSearchTermFilter();
$this->preparePriceAggregation();
diff --git a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartConfigurableTest.xml b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartConfigurableTest.xml
index 1a024b32ce7f2..1456ad4c80fce 100644
--- a/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartConfigurableTest.xml
+++ b/app/code/Magento/CatalogSearch/Test/Mftf/Test/SearchEntityResultsTest/QuickSearchAndAddToCartConfigurableTest.xml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/app/code/Magento/CatalogSearch/composer.json b/app/code/Magento/CatalogSearch/composer.json
index ccea24a0010a9..19cc6b447d804 100644
--- a/app/code/Magento/CatalogSearch/composer.json
+++ b/app/code/Magento/CatalogSearch/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/AdminCategoryRestrictedUrlMessageData.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/AdminCategoryRestrictedUrlMessageData.xml
index 5fbf9e474e232..469b699df52b8 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/AdminCategoryRestrictedUrlMessageData.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Data/AdminCategoryRestrictedUrlMessageData.xml
@@ -14,5 +14,6 @@
URL key "rest" matches a reserved endpoint name (admin, soap, rest, graphql, standard). Use another URL key.
URL key "graphql" matches a reserved endpoint name (admin, soap, rest, graphql, standard). Use another URL key.
URL key "admin" matches a reserved endpoint name (admin). Use another URL key.
+
URL key "admin" matches a reserved endpoint name
diff --git a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
index 57ed644d1a926..e1b59c07d187a 100644
--- a/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
+++ b/app/code/Magento/CatalogUrlRewrite/Test/Mftf/Test/AdminCategoryWithRestrictedUrlKeyNotCreatedTest.xml
@@ -46,12 +46,12 @@
-
+
-
+
diff --git a/app/code/Magento/CatalogUrlRewrite/composer.json b/app/code/Magento/CatalogUrlRewrite/composer.json
index 822d2674ac559..f50d88712f8ce 100644
--- a/app/code/Magento/CatalogUrlRewrite/composer.json
+++ b/app/code/Magento/CatalogUrlRewrite/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/CatalogUrlRewriteGraphQl/composer.json b/app/code/Magento/CatalogUrlRewriteGraphQl/composer.json
index 797d970c6c95a..3cb292c59e6a5 100644
--- a/app/code/Magento/CatalogUrlRewriteGraphQl/composer.json
+++ b/app/code/Magento/CatalogUrlRewriteGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-store": "*",
"magento/module-catalog": "*",
"magento/module-catalog-graph-ql": "*",
diff --git a/app/code/Magento/CatalogWidget/composer.json b/app/code/Magento/CatalogWidget/composer.json
index e1756b9bd2cf7..e2ca79001d9c4 100644
--- a/app/code/Magento/CatalogWidget/composer.json
+++ b/app/code/Magento/CatalogWidget/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/Checkout/Model/TotalsInformationManagement.php b/app/code/Magento/Checkout/Model/TotalsInformationManagement.php
index 7328f8845545c..25e2f0ba4e005 100644
--- a/app/code/Magento/Checkout/Model/TotalsInformationManagement.php
+++ b/app/code/Magento/Checkout/Model/TotalsInformationManagement.php
@@ -5,14 +5,14 @@
*/
namespace Magento\Checkout\Model;
+use Magento\Checkout\Api\Data\TotalsInformationInterface;
+
/**
* Class for management of totals information.
*/
class TotalsInformationManagement implements \Magento\Checkout\Api\TotalsInformationManagementInterface
{
/**
- * Cart total repository.
- *
* @var \Magento\Quote\Api\CartTotalRepositoryInterface
*/
protected $cartTotalRepository;
@@ -42,7 +42,7 @@ public function __construct(
*/
public function calculate(
$cartId,
- \Magento\Checkout\Api\Data\TotalsInformationInterface $addressInformation
+ TotalsInformationInterface $addressInformation
) {
/** @var \Magento\Quote\Model\Quote $quote */
$quote = $this->cartRepository->get($cartId);
@@ -53,9 +53,19 @@ public function calculate(
} else {
$quote->setShippingAddress($addressInformation->getAddress());
if ($addressInformation->getShippingCarrierCode() && $addressInformation->getShippingMethodCode()) {
- $quote->getShippingAddress()->setCollectShippingRates(true)->setShippingMethod(
- $addressInformation->getShippingCarrierCode().'_'.$addressInformation->getShippingMethodCode()
+ $shippingMethod = implode(
+ '_',
+ [$addressInformation->getShippingCarrierCode(), $addressInformation->getShippingMethodCode()]
);
+ $quoteShippingAddress = $quote->getShippingAddress();
+ if ($quoteShippingAddress->getShippingMethod() &&
+ $quoteShippingAddress->getShippingMethod() !== $shippingMethod
+ ) {
+ $quoteShippingAddress->setShippingAmount(0);
+ $quoteShippingAddress->setBaseShippingAmount(0);
+ }
+ $quoteShippingAddress->setCollectShippingRates(true)
+ ->setShippingMethod($shippingMethod);
}
}
$quote->collectTotals();
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest/CheckCheckoutSuccessPageAsRegisterCustomerTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest/CheckCheckoutSuccessPageAsRegisterCustomerTest.xml
index 2c878357ca261..0993f8ba6fa7e 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest/CheckCheckoutSuccessPageAsRegisterCustomerTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/CheckCheckoutSuccessPageTest/CheckCheckoutSuccessPageAsRegisterCustomerTest.xml
@@ -15,9 +15,6 @@
-
-
-
@@ -30,7 +27,7 @@
-
+
@@ -46,35 +43,35 @@
-
+
-
+
-
+
-
+
-
+
-
+
@@ -83,16 +80,16 @@
-
+
-
+
-
+
@@ -100,23 +97,23 @@
-
+
-
+
-
+
-
+
@@ -125,11 +122,11 @@
-
+
-
+
@@ -138,11 +135,16 @@
-
+
-
-
-
+
+ sales/order/print/order_id/
+ COMPARISON_PATH_SUBSET_MATCH
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
index 8b1a1b2a62eb6..64f392d39edcb 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingDefaultAddressTest.xml
@@ -76,23 +76,25 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
-
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
index 7b6b07f467fbb..fb8ae7d5f5746 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNewAddressTest.xml
@@ -89,21 +89,19 @@
-
+
-
-
-
-
-
-
-
+
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
index 7301cfb48ccc7..b60b60d5d0dc5 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonDefaultAddressTest.xml
@@ -82,17 +82,18 @@
-
+
+
+
+
-
+
-
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonExistentCustomerGroupTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonExistentCustomerGroupTest.xml
index a8a5e4a4cc5ed..90bec93990b10 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonExistentCustomerGroupTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutAsCustomerUsingNonExistentCustomerGroupTest.xml
@@ -86,20 +86,23 @@
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
index dfd4a5deadaf6..b8b8155159d37 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutUsingSignInLinkTest.xml
@@ -70,11 +70,12 @@
-
-
-
-
-
+
+
+
+
+
+
@@ -82,12 +83,12 @@
+
+
-
+
-
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
index f2ce8bd0eadd2..90bf2c1465e43 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/OnePageCheckoutWithAllProductTypesTest.xml
@@ -191,10 +191,11 @@
-
-
-
-
+
+
+
+
+
@@ -202,12 +203,12 @@
+
+
-
+
-
-
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
index f20b2c22f99a2..1462685c3054f 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StoreFrontCheckCustomerInfoCreatedByGuestTest.xml
@@ -58,9 +58,12 @@
+
-
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
index 4b98a1f177af8..eb76748a81c97 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerLoginDuringCheckoutTest.xml
@@ -33,6 +33,9 @@
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml
index e09c2a3af2f3e..48059ef66d47a 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontCustomerPlaceOrderWithNewAddressesThatWasEditedTest.xml
@@ -75,7 +75,8 @@
-
+
+
diff --git a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
index 99a9e0273430d..71e884cc36fb4 100644
--- a/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
+++ b/app/code/Magento/Checkout/Test/Mftf/Test/StorefrontRefreshPageDuringGuestCheckoutTest.xml
@@ -58,8 +58,10 @@
-
-
+
+
+
+
diff --git a/app/code/Magento/Checkout/Test/Unit/Model/TotalsInformationManagementTest.php b/app/code/Magento/Checkout/Test/Unit/Model/TotalsInformationManagementTest.php
index 61049b4893476..d6feb38dc6012 100644
--- a/app/code/Magento/Checkout/Test/Unit/Model/TotalsInformationManagementTest.php
+++ b/app/code/Magento/Checkout/Test/Unit/Model/TotalsInformationManagementTest.php
@@ -12,6 +12,7 @@
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\CartTotalRepositoryInterface;
+use Magento\Quote\Model\Quote;
use Magento\Quote\Model\Quote\Address;
class TotalsInformationManagementTest extends \PHPUnit\Framework\TestCase
@@ -67,7 +68,7 @@ public function testCalculate(?string $carrierCode, ?string $carrierMethod, int
{
$cartId = 1;
$cartMock = $this->createMock(
- \Magento\Quote\Model\Quote::class
+ Quote::class
);
$cartMock->expects($this->once())->method('getItemsCount')->willReturn(1);
$cartMock->expects($this->once())->method('getIsVirtual')->willReturn(false);
@@ -101,6 +102,72 @@ public function testCalculate(?string $carrierCode, ?string $carrierMethod, int
$this->totalsInformationManagement->calculate($cartId, $addressInformationMock);
}
+ /**
+ * Test case when shipping amount must be reset to 0 because of changed shipping method.
+ */
+ public function testResetShippingAmount()
+ {
+ $cartId = 1;
+ $carrierCode = 'carrier_code';
+ $carrierMethod = 'carrier_method';
+
+ $cartMock = $this->createMock(Quote::class);
+ $cartMock->method('getItemsCount')
+ ->willReturn(1);
+ $cartMock->method('getIsVirtual')
+ ->willReturn(false);
+ $this->cartRepositoryMock->method('get')->with($cartId)->willReturn($cartMock);
+ $this->cartTotalRepositoryMock->method('get')->with($cartId);
+
+ $addressInformationMock = $this->createMock(TotalsInformationInterface::class);
+ $addressMock = $this->getMockBuilder(Address::class)
+ ->addMethods(
+ [
+ 'setShippingMethod',
+ 'setCollectShippingRates'
+ ]
+ )->onlyMethods(
+ [
+ 'getShippingMethod',
+ 'setShippingAmount',
+ 'setBaseShippingAmount',
+ ]
+ )
+ ->disableOriginalConstructor()
+ ->getMock();
+ $addressMock->method('getShippingMethod')
+ ->willReturn('flatrate_flatrate');
+ $addressInformationMock->method('getAddress')
+ ->willReturn($addressMock);
+ $addressInformationMock->method('getShippingCarrierCode')
+ ->willReturn($carrierCode);
+ $addressInformationMock->method('getShippingMethodCode')
+ ->willReturn($carrierMethod);
+ $cartMock->method('setShippingAddress')
+ ->with($addressMock);
+ $cartMock->method('getShippingAddress')
+ ->willReturn($addressMock);
+ $addressMock->expects($this->once())
+ ->method('setCollectShippingRates')
+ ->with(true)
+ ->willReturn($addressMock);
+ $addressMock->expects($this->once())
+ ->method('setShippingAmount')
+ ->with(0)
+ ->willReturn($addressMock);
+ $addressMock->expects($this->once())
+ ->method('setBaseShippingAmount')
+ ->with(0)
+ ->willReturn($addressMock);
+ $addressMock->expects($this->once())
+ ->method('setShippingMethod')
+ ->with($carrierCode . '_' . $carrierMethod);
+ $cartMock->expects($this->once())
+ ->method('collectTotals');
+
+ $this->totalsInformationManagement->calculate($cartId, $addressInformationMock);
+ }
+
/**
* Data provider for testCalculate.
*
diff --git a/app/code/Magento/Checkout/composer.json b/app/code/Magento/Checkout/composer.json
index fa5dcb5730f4a..753ea5dc0749f 100644
--- a/app/code/Magento/Checkout/composer.json
+++ b/app/code/Magento/Checkout/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-captcha": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html
index 765c260ac9d07..b74896972b28c 100644
--- a/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html
+++ b/app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html
@@ -42,7 +42,7 @@
-
+
@@ -83,7 +83,7 @@
type="number"
size="4"
class="item-qty cart-item-qty"/>
-
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionPriceActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionPriceActionGroup.xml
new file mode 100644
index 0000000000000..83db1ac3fa954
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionPriceActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{price}}
+ getOptionPrice
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionQtyActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionQtyActionGroup.xml
new file mode 100644
index 0000000000000..78528cdaa0625
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionQtyActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{qty}}
+ getOptionQty
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionStatusActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionStatusActionGroup.xml
new file mode 100644
index 0000000000000..a54ea8044516a
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionStatusActionGroup.xml
@@ -0,0 +1,18 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionWeightActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionWeightActionGroup.xml
new file mode 100644
index 0000000000000..e9d528be18cf4
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/AdminConfigurableProductVerifyOptionWeightActionGroup.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+ {{weight}}
+ getOptionWeight
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml
index 80248cf5e00f8..b05099da8e85c 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/ActionGroup/GenerateConfigurationsByAttributeCodeActionGroup.xml
@@ -20,11 +20,11 @@
-
+
-
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection/AdminProductFormConfigurationsSection.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection/AdminProductFormConfigurationsSection.xml
index 264a3d4e75032..ddb62ea9601a1 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection/AdminProductFormConfigurationsSection.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Section/AdminProductFormConfigurationsSection/AdminProductFormConfigurationsSection.xml
@@ -19,6 +19,7 @@
+
@@ -34,6 +35,7 @@
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckProductQtyAfterOrderCancellingTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckProductQtyAfterOrderCancellingTest.xml
index 0b9b5c98d9884..16ecd9b8852f6 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckProductQtyAfterOrderCancellingTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminCheckProductQtyAfterOrderCancellingTest.xml
@@ -38,7 +38,7 @@
-
+
@@ -46,25 +46,24 @@
-
+
-
-
+
+
+
-
-
-
-
-
+
+
+
-
-
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductAddNewOptionsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductAddNewOptionsTest.xml
new file mode 100644
index 0000000000000..02a3417a48ffc
--- /dev/null
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductAddNewOptionsTest.xml
@@ -0,0 +1,203 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest/AdminConfigurableProductCreateTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest/AdminConfigurableProductCreateTest.xml
index a17fcf1ddf306..cac1f185bc4d9 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest/AdminConfigurableProductCreateTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductCreateTest/AdminConfigurableProductCreateTest.xml
@@ -49,6 +49,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductAddConfigurationTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductAddConfigurationTest.xml
index a84fde213504e..a01da89c06eb8 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductAddConfigurationTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductAddConfigurationTest.xml
@@ -49,6 +49,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveConfigurationTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveConfigurationTest.xml
index 7078100272eb7..aa080279ca550 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveConfigurationTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableProductUpdateTest/AdminConfigurableProductRemoveConfigurationTest.xml
@@ -38,6 +38,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
index 775ffe1cf1ad8..894e7987f624d 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/AdminConfigurableSetEditRelatedProductsTest.xml
@@ -30,6 +30,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
index 328984e973d5c..517261602cb1c 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/NoErrorForMiniCartItemEditTest.xml
@@ -42,6 +42,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductBasicInfoTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductBasicInfoTest.xml
index 99b4cf5d4c3a5..123c509207f09 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductBasicInfoTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductBasicInfoTest.xml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCanAddToCartTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCanAddToCartTest.xml
index effe69a9d3b0c..6ab7d6f5500a7 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCanAddToCartTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCanAddToCartTest.xml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCantAddToCartTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCantAddToCartTest.xml
index 8cd5b95680b55..4f5ce829929a5 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCantAddToCartTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductCantAddToCartTest.xml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductOptionsTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductOptionsTest.xml
index 1a2a1bb379df2..2b83c302d2390 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductOptionsTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductDetailsTest/StorefrontConfigurableProductOptionsTest.xml
@@ -43,6 +43,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml
index 440899eb6fd4b..e4783076352da 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductAddToCartTest.xml
@@ -55,6 +55,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductGridViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductGridViewTest.xml
index 47096f317599e..c478c4cdfdde5 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductGridViewTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductGridViewTest.xml
@@ -45,6 +45,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductListViewTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductListViewTest.xml
index e0b1e85fa9b9c..35a94439398d6 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductListViewTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductViewTest/StorefrontConfigurableProductListViewTest.xml
@@ -55,6 +55,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
index 742b67d2a6918..30c142886f9a9 100644
--- a/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
+++ b/app/code/Magento/ConfigurableProduct/Test/Mftf/Test/StorefrontConfigurableProductWithFileCustomOptionTest.xml
@@ -49,6 +49,9 @@
+
+
+
diff --git a/app/code/Magento/ConfigurableProduct/composer.json b/app/code/Magento/ConfigurableProduct/composer.json
index 715b6f46fcfce..584129dd863c8 100644
--- a/app/code/Magento/ConfigurableProduct/composer.json
+++ b/app/code/Magento/ConfigurableProduct/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/ConfigurableProduct/etc/di.xml b/app/code/Magento/ConfigurableProduct/etc/di.xml
index 01edbe6cd75ca..270e8ec746097 100644
--- a/app/code/Magento/ConfigurableProduct/etc/di.xml
+++ b/app/code/Magento/ConfigurableProduct/etc/di.xml
@@ -17,6 +17,8 @@
+
+
@@ -54,7 +56,7 @@
- - \Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE
+ - Magento\ConfigurableProduct\Model\Product\Type\Configurable::TYPE_CODE
@@ -208,6 +210,12 @@
Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\BaseStockStatusSelectProcessor
+
+
+ Magento\ConfigurableProduct\Model\ResourceModel\Product\Indexer\Price\BaseStockStatusSelectProcessor
+ indexer
+
+
Magento\Catalog\Model\Indexer\Product\Full
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/summary.phtml b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/summary.phtml
index 379e129b68c7e..439fd0c934403 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/summary.phtml
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/templates/catalog/product/edit/attribute/steps/summary.phtml
@@ -5,6 +5,7 @@
*/
/* @var $block \Magento\ConfigurableProduct\Block\Adminhtml\Product\Steps\Summary */
+
?>
= $block->escapeHtml(
@@ -52,8 +53,12 @@
"= /* @noEscape */ $block->getComponentName() ?>": {
"component": "Magento_ConfigurableProduct/js/variations/steps/summary",
"appendTo": "= /* @noEscape */ $block->getParentComponentName() ?>",
- "variationsComponent": "= /* @noEscape */ $block->getData('config/form') ?>.configurableVariations",
- "modalComponent": "= /* @noEscape */ $block->getData('config/form') ?>.configurableModal"
+ "variationsComponent": "= /* @noEscape */ $block->getData('config/form')
+ ?>.configurableVariations",
+ "modalComponent": "= /* @noEscape */ $block->getData('config/form')
+ ?>.configurableModal",
+ "matrixGridComponent": "= /* @noEscape */ $block->getData('config/form')
+ ?>.configurable.configurable-matrix"
}
}
}
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js
index ac952ca531a34..f5c9382af0bc3 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/steps/summary.js
@@ -17,7 +17,8 @@ define([
defaults: {
modules: {
variationsComponent: '${ $.variationsComponent }',
- modalComponent: '${ $.modalComponent }'
+ modalComponent: '${ $.modalComponent }',
+ matrixGridComponent: '${ $.matrixGridComponent }'
},
notificationMessage: {
text: null,
@@ -96,11 +97,16 @@ define([
variationsKeys = [],
gridExisting = [],
gridNew = [],
- gridDeleted = [];
+ gridDeleted = [],
+ matrixGridData = this.matrixGridComponent() ?
+ _.indexBy(this.matrixGridComponent().getUnionInsertData(), 'variationKey') : {};
this.variations = [];
_.each(variations, function (options) {
var product, images, sku, name, quantity, price, variation,
+ variationsKey = this.variationsComponent().getVariationKey(options),
+ productDataFromGrid = matrixGridData[variationsKey] || {},
+ productDataFromWizard = {},
productId = this.variationsComponent().getProductIdByOptions(options);
if (productId) {
@@ -117,40 +123,61 @@ define([
}, '');
quantity = getSectionValue(this.quantityFieldName, options);
- if (!quantity && productId) {
- quantity = product[this.quantityFieldName];
+ if (quantity) {
+ productDataFromWizard[this.quantityFieldName] = quantity;
}
price = getSectionValue('price', options);
- if (!price) {
- price = productId ? product.price : productPrice;
+ if (price) {
+ productDataFromWizard.price = price;
}
if (productId && !images.file) {
images = product.images;
}
+ productDataFromGrid = _.pick(
+ productDataFromGrid,
+ 'sku',
+ 'name',
+ 'weight',
+ 'status',
+ 'price',
+ 'qty'
+ );
+
+ if (productDataFromGrid.hasOwnProperty('qty')) {
+ productDataFromGrid[this.quantityFieldName] = productDataFromGrid.qty;
+ }
+ delete productDataFromGrid.qty;
+ product = _.pick(
+ product || {},
+ 'sku',
+ 'name',
+ 'weight',
+ 'status',
+ 'price',
+ this.quantityFieldName
+ );
variation = {
options: options,
images: images,
sku: sku,
name: name,
- price: price,
+ price: productPrice,
productId: productId,
weight: productWeight,
editable: true
};
variation[this.quantityFieldName] = quantity;
+ variation = _.extend(variation, product, productDataFromGrid, productDataFromWizard);
if (productId) {
- variation.sku = product.sku;
- variation.weight = product.weight;
- variation.name = product.name;
gridExisting.push(this.prepareRowForGrid(variation));
} else {
gridNew.push(this.prepareRowForGrid(variation));
}
this.variations.push(variation);
- variationsKeys.push(this.variationsComponent().getVariationKey(options));
+ variationsKeys.push(variationsKey);
}, this);
_.each(_.omit(this.variationsComponent().productAttributesMap, variationsKeys), function (productId) {
diff --git a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html
index bf1e1ad5fe1e1..1e9224dc20fe3 100644
--- a/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html
+++ b/app/code/Magento/ConfigurableProduct/view/adminhtml/web/template/variations/steps/summary-grid.html
@@ -7,7 +7,7 @@
-
+
diff --git a/app/code/Magento/ConfigurableProductGraphQl/composer.json b/app/code/Magento/ConfigurableProductGraphQl/composer.json
index 77c069939ac1a..6927ef82e91f6 100644
--- a/app/code/Magento/ConfigurableProductGraphQl/composer.json
+++ b/app/code/Magento/ConfigurableProductGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-catalog": "*",
"magento/module-configurable-product": "*",
"magento/module-graph-ql": "*",
diff --git a/app/code/Magento/ConfigurableProductSales/composer.json b/app/code/Magento/ConfigurableProductSales/composer.json
index 78b69acd010f4..69ec6b3913960 100644
--- a/app/code/Magento/ConfigurableProductSales/composer.json
+++ b/app/code/Magento/ConfigurableProductSales/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-sales": "*",
diff --git a/app/code/Magento/Contact/composer.json b/app/code/Magento/Contact/composer.json
index 75de22ee779ae..4925097577eb5 100644
--- a/app/code/Magento/Contact/composer.json
+++ b/app/code/Magento/Contact/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-cms": "*",
"magento/module-config": "*",
diff --git a/app/code/Magento/Cookie/Test/Mftf/Test/StorefrontVerifyUnsecureCookieTest.xml b/app/code/Magento/Cookie/Test/Mftf/Test/StorefrontVerifyUnsecureCookieTest.xml
index 7ae6b90893165..7f7b487725dd0 100644
--- a/app/code/Magento/Cookie/Test/Mftf/Test/StorefrontVerifyUnsecureCookieTest.xml
+++ b/app/code/Magento/Cookie/Test/Mftf/Test/StorefrontVerifyUnsecureCookieTest.xml
@@ -28,11 +28,13 @@
+
isCookieSecure
false
+
isCookieSecure2
diff --git a/app/code/Magento/Cookie/composer.json b/app/code/Magento/Cookie/composer.json
index 7cd98541eb880..b2d1946bc4666 100644
--- a/app/code/Magento/Cookie/composer.json
+++ b/app/code/Magento/Cookie/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-store": "*"
},
diff --git a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
index d10ed4979fa37..49556f75b37f0 100644
--- a/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
+++ b/app/code/Magento/Cron/Model/Config/Backend/Sitemap.php
@@ -21,12 +21,12 @@ class Sitemap extends \Magento\Framework\App\Config\Value
/**
* Cron string path for product alerts
*/
- const CRON_STRING_PATH = 'crontab/default/jobs/sitemap_generate/schedule/cron_expr';
+ public const CRON_STRING_PATH = 'crontab/default/jobs/sitemap_generate/schedule/cron_expr';
/**
* Cron mode path
*/
- const CRON_MODEL_PATH = 'crontab/default/jobs/sitemap_generate/run/model';
+ public const CRON_MODEL_PATH = 'crontab/default/jobs/sitemap_generate/run/model';
/**
* @var \Magento\Framework\App\Config\ValueFactory
@@ -73,8 +73,12 @@ public function __construct(
*/
public function afterSave()
{
- $time = $this->getData('groups/generate/fields/time/value');
- $frequency = $this->getData('groups/generate/fields/frequency/value');
+ $time = $this->getData('groups/generate/fields/time/value') ?:
+ explode(
+ ',',
+ $this->_config->getValue('sitemap/generate/time', $this->getScope(), $this->getScopeId()) ?: '0,0,0'
+ );
+ $frequency = $this->getValue();
$cronExprArray = [
(int)($time[1] ?? 0), //Minute
diff --git a/app/code/Magento/Cron/Model/Config/Converter/Db.php b/app/code/Magento/Cron/Model/Config/Converter/Db.php
index 232ca8604774c..48b81579c6b49 100644
--- a/app/code/Magento/Cron/Model/Config/Converter/Db.php
+++ b/app/code/Magento/Cron/Model/Config/Converter/Db.php
@@ -29,7 +29,7 @@ public function convert($source)
/**
* Extract and prepare cron job data
*
- * @param array $jobs
+ * @param array $cronTab
* @return array
*/
protected function _extractParams(array $cronTab)
@@ -92,7 +92,8 @@ protected function _processScheduleParam(array $jobConfig, $jobName, array &$res
protected function _processRunModel(array $jobConfig, $jobName, array &$result)
{
if (isset($jobConfig['run']) && is_array($jobConfig['run']) && array_key_exists('model', $jobConfig['run'])) {
- $callPath = explode('::', $jobConfig['run']['model']);
+ $runModel = $jobConfig['run']['model'];
+ $callPath = $runModel ? explode('::', $runModel) : [];
if (empty($callPath) || empty($callPath[0]) || empty($callPath[1])) {
unset($result[$jobName]['run']);
diff --git a/app/code/Magento/Cron/composer.json b/app/code/Magento/Cron/composer.json
index 7cb4b4402a301..820fa16c4d663 100644
--- a/app/code/Magento/Cron/composer.json
+++ b/app/code/Magento/Cron/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-store": "*"
},
diff --git a/app/code/Magento/Csp/composer.json b/app/code/Magento/Csp/composer.json
index 897cb39ba2760..ef3812ac1ce1f 100644
--- a/app/code/Magento/Csp/composer.json
+++ b/app/code/Magento/Csp/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-store": "*"
},
diff --git a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php
index ee94195a29cc7..c0d0dd68fcc23 100644
--- a/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php
+++ b/app/code/Magento/CurrencySymbol/Block/Adminhtml/System/Currency/Rate/Matrix.php
@@ -107,7 +107,7 @@ protected function _prepareRates($array)
foreach ($array as $key => $rate) {
foreach ($rate as $code => $value) {
- $parts = explode('.', $value);
+ $parts = $value !== null ? explode('.', $value) : [];
if (count($parts) == 2) {
$parts[1] = str_pad(rtrim($parts[1], 0), 4, '0', STR_PAD_RIGHT);
$array[$key][$code] = join('.', $parts);
diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCheckCurrencyConverterApiConfigurationTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCheckCurrencyConverterApiConfigurationTest.xml
index c36ce89d9dfad..91ae96e2656df 100644
--- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCheckCurrencyConverterApiConfigurationTest.xml
+++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminCheckCurrencyConverterApiConfigurationTest.xml
@@ -23,14 +23,22 @@
+
+
+
+
+
+
+
+
@@ -57,6 +65,7 @@
+
@@ -79,6 +88,7 @@
+
diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml
index 997107020a574..a566dc4c37868 100644
--- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml
+++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminDefaultCurrencySymbolsAreDisabledTest.xml
@@ -23,7 +23,15 @@
-
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml
index 146671e36af68..1b1af9acdf1a7 100644
--- a/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml
+++ b/app/code/Magento/CurrencySymbol/Test/Mftf/Test/AdminOrderRateDisplayedInOneLineTest.xml
@@ -43,9 +43,20 @@
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
diff --git a/app/code/Magento/CurrencySymbol/composer.json b/app/code/Magento/CurrencySymbol/composer.json
index f8fdb954e12a4..8dc19209cb9c8 100644
--- a/app/code/Magento/CurrencySymbol/composer.json
+++ b/app/code/Magento/CurrencySymbol/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-config": "*",
diff --git a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php
index da20bc9b4871d..dcbe1e9b96ed9 100644
--- a/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php
+++ b/app/code/Magento/Customer/Block/Adminhtml/Edit/Tab/View/PersonalInfo.php
@@ -23,39 +23,29 @@ class PersonalInfo extends \Magento\Backend\Block\Template
* since his last activity. Used only if it's impossible to get such setting
* from configuration.
*/
- const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
+ public const DEFAULT_ONLINE_MINUTES_INTERVAL = 15;
/**
- * Customer
- *
* @var \Magento\Customer\Api\Data\CustomerInterface
*/
protected $customer;
/**
- * Customer log
- *
* @var \Magento\Customer\Model\Log
*/
protected $customerLog;
/**
- * Customer logger
- *
* @var \Magento\Customer\Model\Logger
*/
protected $customerLogger;
/**
- * Customer registry
- *
* @var \Magento\Customer\Model\CustomerRegistry
*/
protected $customerRegistry;
/**
- * Account management
- *
* @var AccountManagementInterface
*/
protected $accountManagement;
@@ -68,43 +58,31 @@ class PersonalInfo extends \Magento\Backend\Block\Template
protected $groupRepository;
/**
- * Customer data factory
- *
* @var \Magento\Customer\Api\Data\CustomerInterfaceFactory
*/
protected $customerDataFactory;
/**
- * Address helper
- *
* @var \Magento\Customer\Helper\Address
*/
protected $addressHelper;
/**
- * Date time
- *
* @var \Magento\Framework\Stdlib\DateTime
*/
protected $dateTime;
/**
- * Core registry
- *
* @var \Magento\Framework\Registry
*/
protected $coreRegistry;
/**
- * Address mapper
- *
* @var Mapper
*/
protected $addressMapper;
/**
- * Data object helper
- *
* @var \Magento\Framework\Api\DataObjectHelper
*/
protected $dataObjectHelper;
@@ -439,7 +417,8 @@ public function getLastLoginDate()
*/
public function getStoreLastLoginDate()
{
- $date = strtotime($this->getCustomerLog()->getLastLoginAt());
+ $lastLogin = $this->getCustomerLog()->getLastLoginAt();
+ $date = $lastLogin !== null ? strtotime($lastLogin) : false;
if ($date) {
$date = $this->_localeDate->scopeDate($this->getCustomer()->getStoreId(), $date, true);
diff --git a/app/code/Magento/Customer/Model/Address/AbstractAddress.php b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
index d1364dc0aeba6..bdf29d6e93b75 100644
--- a/app/code/Magento/Customer/Model/Address/AbstractAddress.php
+++ b/app/code/Magento/Customer/Model/Address/AbstractAddress.php
@@ -40,9 +40,9 @@ class AbstractAddress extends AbstractExtensibleModel implements AddressModelInt
/**
* Possible customer address types
*/
- const TYPE_BILLING = 'billing';
+ public const TYPE_BILLING = 'billing';
- const TYPE_SHIPPING = 'shipping';
+ public const TYPE_SHIPPING = 'shipping';
/**
* Prefix of model events
@@ -73,8 +73,6 @@ class AbstractAddress extends AbstractExtensibleModel implements AddressModelInt
protected static $_regionModels = [];
/**
- * Directory data
- *
* @var \Magento\Directory\Helper\Data
*/
protected $_directoryData = null;
@@ -241,7 +239,7 @@ public function getStreetLine($number)
public function getStreetFull()
{
$street = $this->getData('street');
- return is_array($street) ? implode("\n", $street) : $street;
+ return is_array($street) ? implode("\n", $street) : ($street ?? '');
}
/**
diff --git a/app/code/Magento/Customer/Model/FileProcessor.php b/app/code/Magento/Customer/Model/FileProcessor.php
index f566d7e9a91f7..68234165208d2 100644
--- a/app/code/Magento/Customer/Model/FileProcessor.php
+++ b/app/code/Magento/Customer/Model/FileProcessor.php
@@ -27,7 +27,7 @@ class FileProcessor
/**
* Temporary directory name
*/
- const TMP_DIR = 'tmp';
+ public const TMP_DIR = 'tmp';
private const CUSTOMER_FILE_URL_PATH = 'customer/index/viewfile';
@@ -215,12 +215,13 @@ public function saveTemporaryFile($fileId)
);
$result = $uploader->save($path);
- unset($result['path']);
+
if (!$result) {
throw new LocalizedException(
__('File can not be saved to the destination folder.')
);
}
+ unset($result['path']);
return $result;
}
diff --git a/app/code/Magento/Customer/Model/Indexer/Source.php b/app/code/Magento/Customer/Model/Indexer/Source.php
index 89e17e01bb48e..b48e7e5ad9d05 100644
--- a/app/code/Magento/Customer/Model/Indexer/Source.php
+++ b/app/code/Magento/Customer/Model/Indexer/Source.php
@@ -82,6 +82,7 @@ public function addFieldToFilter($attribute, $condition = null)
/**
* @inheritdoc
*/
+ #[\ReturnTypeWillChange]
public function count()
{
return $this->customerCollection->getSize();
@@ -92,6 +93,7 @@ public function count()
*
* @return Traversable
*/
+ #[\ReturnTypeWillChange]
public function getIterator()
{
$this->customerCollection->setPageSize($this->batchSize);
diff --git a/app/code/Magento/Customer/Model/Options.php b/app/code/Magento/Customer/Model/Options.php
index 4c9b9f97ad43a..ec995a12e2bc2 100644
--- a/app/code/Magento/Customer/Model/Options.php
+++ b/app/code/Magento/Customer/Model/Options.php
@@ -49,7 +49,7 @@ public function getNamePrefixOptions($store = null)
{
return $this->prepareNamePrefixSuffixOptions(
$this->addressHelper->getConfig('prefix_options', $store),
- $this->addressHelper->getConfig('prefix_show', $store) == NooptreqSource::VALUE_OPTIONAL
+ $this->addressHelper->getConfig('prefix_show', $store) === NooptreqSource::VALUE_OPTIONAL
);
}
@@ -63,7 +63,7 @@ public function getNameSuffixOptions($store = null)
{
return $this->prepareNamePrefixSuffixOptions(
$this->addressHelper->getConfig('suffix_options', $store),
- $this->addressHelper->getConfig('suffix_show', $store) == NooptreqSource::VALUE_OPTIONAL
+ $this->addressHelper->getConfig('suffix_show', $store) === NooptreqSource::VALUE_OPTIONAL
);
}
@@ -93,13 +93,12 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false
*/
private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
{
- $options = trim($options);
- if (empty($options)) {
+ if ($options === null || empty(trim($options))) {
return false;
}
-
$result = [];
- $options = explode(';', $options);
+ $options = explode(';', trim($options));
+
foreach ($options as $value) {
$result[] = $this->escaper->escapeHtml(trim($value)) ?: ' ';
}
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerShopingCartActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerShopingCartActionGroup.xml
index d4155c2e19d2c..df5cd9c8b47a2 100644
--- a/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerShopingCartActionGroup.xml
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/AdminCustomerShopingCartActionGroup.xml
@@ -15,17 +15,17 @@
-
+
-
+
-
-
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml
index 5833bf07aeae2..df7b0e2923020 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminChangeSingleCustomerGroupViaGridTest.xml
@@ -24,6 +24,8 @@
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml
index 9f6d8d645e5f4..78adcd9058ec2 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerRetailerWithoutAddressTest.xml
@@ -25,6 +25,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
index b191ae9406610..efe18f8b631d6 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
@@ -26,6 +26,10 @@
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml
index 0cef6744d814b..29941d7223c08 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithCustomGroupTest.xml
@@ -29,6 +29,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml
index eaa3a11edb74e..7f66b657180f1 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithPrefixTest.xml
@@ -25,6 +25,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml
index fd9975c337346..8f2e20e90d758 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerWithoutAddressTest.xml
@@ -28,6 +28,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml
index 44eab9d0c19ae..2cd231d0bf396 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontSignupNewsletterTest.xml
@@ -26,6 +26,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml
index 444e9aa643181..6d917d3d18b43 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerOnStorefrontTest.xml
@@ -26,6 +26,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml
index 5edb9d08da46d..c3dbad6708156 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateNewCustomerTest.xml
@@ -25,6 +25,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml
index 87111ec6fba1a..309da1add5ffd 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCustomerSubscribeNewsletterPerWebsiteTest.xml
@@ -29,6 +29,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml
index 03691eb7e7b72..059216036280a 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerTest.xml
@@ -34,6 +34,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminGridSelectAllOnPageTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminGridSelectAllOnPageTest.xml
index 578c6786c1505..ef4dc560d4fee 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminGridSelectAllOnPageTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminGridSelectAllOnPageTest.xml
@@ -38,7 +38,7 @@
-
+
@@ -46,7 +46,7 @@
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
index 6ecb20ab8072a..654b9b4c9d013 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
@@ -19,6 +19,9 @@
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml
index d78d676a822d9..f0e79ee5494c8 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminVerifyCustomerAddressRequiredFieldsTest.xml
@@ -20,6 +20,9 @@
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddProductToCartVerifyThatErrorMessageShouldNotDisappearTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddProductToCartVerifyThatErrorMessageShouldNotDisappearTest.xml
new file mode 100644
index 0000000000000..ccca330f5ff1a
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontAddProductToCartVerifyThatErrorMessageShouldNotDisappearTest.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
index b9c558c65c513..82573f1a986f0 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCheckTaxAddingValidVATIdTest.xml
@@ -140,6 +140,11 @@
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
index 148afb6d67c21..d9e665ec7a2ad 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
@@ -41,5 +41,6 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
index b800b7870b5c5..d92b47c3990a1 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressBelgiumTest.xml
@@ -34,6 +34,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
index 41e0a5d1b7793..afc9f1a88654b 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressChinaTest.xml
@@ -34,6 +34,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
index 1ecfb20b38e19..1f92b429603e6 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressFranceTest.xml
@@ -35,6 +35,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
index 8e29452b5495e..7b5ad9d70fd7c 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontUpdateCustomerAddressUKTest.xml
@@ -35,6 +35,7 @@
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
index eda4d189eda64..6f2ed3ac11805 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontVerifyNoXssInjectionOnUpdateCustomerInformationAddAddressTest.xml
@@ -39,6 +39,7 @@
+
diff --git a/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php b/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php
index 16caf346c808c..edc15bc60b4dd 100644
--- a/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php
+++ b/app/code/Magento/Customer/Ui/Component/MassAction/Group/Options.php
@@ -81,6 +81,7 @@ public function __construct(
*
* @return array
*/
+ #[\ReturnTypeWillChange]
public function jsonSerialize()
{
if ($this->options === null) {
diff --git a/app/code/Magento/Customer/composer.json b/app/code/Magento/Customer/composer.json
index 767b24d2ce388..ccf38f4fd5d7b 100644
--- a/app/code/Magento/Customer/composer.json
+++ b/app/code/Magento/Customer/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-authorization": "*",
"magento/module-backend": "*",
diff --git a/app/code/Magento/CustomerAnalytics/composer.json b/app/code/Magento/CustomerAnalytics/composer.json
index c3ba4aed610f9..1073377600578 100644
--- a/app/code/Magento/CustomerAnalytics/composer.json
+++ b/app/code/Magento/CustomerAnalytics/composer.json
@@ -2,7 +2,7 @@
"name": "magento/module-customer-analytics",
"description": "N/A",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-customer": "*",
"magento/module-analytics": "*"
diff --git a/app/code/Magento/CustomerDownloadableGraphQl/composer.json b/app/code/Magento/CustomerDownloadableGraphQl/composer.json
index 55fd9d7638f04..20381eb7e065e 100644
--- a/app/code/Magento/CustomerDownloadableGraphQl/composer.json
+++ b/app/code/Magento/CustomerDownloadableGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-downloadable-graph-ql": "*",
"magento/module-graph-ql": "*",
"magento/framework": "*"
diff --git a/app/code/Magento/CustomerGraphQl/composer.json b/app/code/Magento/CustomerGraphQl/composer.json
index 28aaa1942cc7d..2762dbe72cf47 100644
--- a/app/code/Magento/CustomerGraphQl/composer.json
+++ b/app/code/Magento/CustomerGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-authorization": "*",
"magento/module-customer": "*",
"magento/module-eav": "*",
diff --git a/app/code/Magento/CustomerImportExport/composer.json b/app/code/Magento/CustomerImportExport/composer.json
index 0583e96359bcf..70650f06b4e0d 100644
--- a/app/code/Magento/CustomerImportExport/composer.json
+++ b/app/code/Magento/CustomerImportExport/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-customer": "*",
diff --git a/app/code/Magento/Deploy/composer.json b/app/code/Magento/Deploy/composer.json
index c8bc5e694af5e..0c6b5895c1b4f 100644
--- a/app/code/Magento/Deploy/composer.json
+++ b/app/code/Magento/Deploy/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-config": "*",
"magento/module-require-js": "*",
diff --git a/app/code/Magento/Developer/composer.json b/app/code/Magento/Developer/composer.json
index dedf18d1d808f..5144438cd9d4d 100644
--- a/app/code/Magento/Developer/composer.json
+++ b/app/code/Magento/Developer/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-config": "*",
"magento/module-store": "*"
diff --git a/app/code/Magento/Dhl/Model/Carrier.php b/app/code/Magento/Dhl/Model/Carrier.php
index d9540c3041ce6..7ea0e670d0d16 100644
--- a/app/code/Magento/Dhl/Model/Carrier.php
+++ b/app/code/Magento/Dhl/Model/Carrier.php
@@ -482,11 +482,12 @@ public function setRequest(\Magento\Framework\DataObject $request)
);
$shippingWeight = $request->getPackageWeight();
+ $destStreet = $request->getDestStreet() !== null ? str_replace("\n", '', $request->getDestStreet()) : '';
$requestObject->setValue(sprintf('%.2f', $request->getPackageValue()))
->setValueWithDiscount($request->getPackageValueWithDiscount())
->setCustomsValue($request->getPackageCustomsValue())
- ->setDestStreet($this->string->substr(str_replace("\n", '', $request->getDestStreet()), 0, 35))
+ ->setDestStreet($this->string->substr($destStreet, 0, 35))
->setDestStreetLine2($request->getDestStreetLine2())
->setDestCity($request->getDestCity())
->setOrigCompanyName($request->getOrigCompanyName())
@@ -939,7 +940,7 @@ protected function _getDimension($dimension, $configWeightUnit = false)
);
}
- return round($dimension, 3);
+ return round((float) $dimension, 3);
}
/**
diff --git a/app/code/Magento/Dhl/composer.json b/app/code/Magento/Dhl/composer.json
index d16d5d3ae0401..75a43b0cdad81 100644
--- a/app/code/Magento/Dhl/composer.json
+++ b/app/code/Magento/Dhl/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"lib-libxml": "*",
"magento/framework": "*",
"magento/module-backend": "*",
diff --git a/app/code/Magento/Directory/Test/Mftf/ActionGroup/AdminNavigateToCurrencySetupPageActionGroup.xml b/app/code/Magento/Directory/Test/Mftf/ActionGroup/AdminNavigateToCurrencySetupPageActionGroup.xml
new file mode 100644
index 0000000000000..0f0237ee8ec33
--- /dev/null
+++ b/app/code/Magento/Directory/Test/Mftf/ActionGroup/AdminNavigateToCurrencySetupPageActionGroup.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+ Go to the currency setup admin configuration page.
+
+
+
+
diff --git a/app/code/Magento/Directory/composer.json b/app/code/Magento/Directory/composer.json
index 6491dd52eee67..058ec128000a4 100644
--- a/app/code/Magento/Directory/composer.json
+++ b/app/code/Magento/Directory/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"lib-libxml": "*",
"magento/framework": "*",
"magento/module-backend": "*",
diff --git a/app/code/Magento/DirectoryGraphQl/composer.json b/app/code/Magento/DirectoryGraphQl/composer.json
index 29b0a76122c11..be5f0c19de967 100644
--- a/app/code/Magento/DirectoryGraphQl/composer.json
+++ b/app/code/Magento/DirectoryGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-directory": "*",
"magento/module-store": "*",
"magento/module-graph-ql": "*",
diff --git a/app/code/Magento/Downloadable/Helper/File.php b/app/code/Magento/Downloadable/Helper/File.php
index 10ee9ff405ec8..f20e1999f4c16 100644
--- a/app/code/Magento/Downloadable/Helper/File.php
+++ b/app/code/Magento/Downloadable/Helper/File.php
@@ -5,7 +5,10 @@
*/
namespace Magento\Downloadable\Helper;
+use Magento\Framework\Exception\FileSystemException;
use Magento\Framework\App\Filesystem\DirectoryList;
+use Magento\Framework\Exception\LocalizedException;
+use Magento\MediaStorage\Model\File\Uploader;
/**
* Downloadable Products File Helper
@@ -16,8 +19,6 @@
class File extends \Magento\Framework\App\Helper\AbstractHelper
{
/**
- * Core file storage database
- *
* @var \Magento\MediaStorage\Helper\File\Storage\Database
*/
protected $_coreFileStorageDatabase = null;
@@ -41,6 +42,7 @@ class File extends \Magento\Framework\App\Helper\AbstractHelper
* @param \Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase
* @param \Magento\Framework\Filesystem $filesystem
* @param array $mimeTypes
+ * @throws FileSystemException
*/
public function __construct(
\Magento\Framework\App\Helper\Context $context,
@@ -61,28 +63,34 @@ public function __construct(
/**
* Upload file from temporary folder.
+ *
* @param string $tmpPath
- * @param \Magento\MediaStorage\Model\File\Uploader $uploader
+ * @param Uploader $uploader
+ *
* @return array
*/
- public function uploadFromTmp($tmpPath, \Magento\MediaStorage\Model\File\Uploader $uploader)
+ public function uploadFromTmp($tmpPath, Uploader $uploader)
{
$uploader->setAllowRenameFiles(true);
$uploader->setFilesDispersion(true);
$absoluteTmpPath = $this->_mediaDirectory->getAbsolutePath($tmpPath);
$result = $uploader->save($absoluteTmpPath);
- unset($result['path']);
+ if (is_array($result)) {
+ unset($result['path']);
+ }
return $result;
}
/**
* Checking file for moving and move it
+ *
* @param string $baseTmpPath
* @param string $basePath
* @param string $file
+ *
* @return string
- * @throws \Magento\Framework\Exception\LocalizedException
+ * @throws LocalizedException
*/
public function moveFileFromTmp($baseTmpPath, $basePath, $file)
{
@@ -92,7 +100,7 @@ public function moveFileFromTmp($baseTmpPath, $basePath, $file)
try {
$fileName = $this->_moveFileFromTmp($baseTmpPath, $basePath, $file[0]['file']);
} catch (\Exception $e) {
- throw new \Magento\Framework\Exception\LocalizedException(
+ throw new LocalizedException(
__('Something went wrong while saving the file(s).')
);
}
@@ -104,6 +112,7 @@ public function moveFileFromTmp($baseTmpPath, $basePath, $file)
/**
* Check if file exist in filesystem and try to re-create it from database record if negative.
+ *
* @param string $file
* @return bool|int
*/
@@ -130,12 +139,9 @@ protected function _moveFileFromTmp($baseTmpPath, $basePath, $file)
if (strrpos($file, '.tmp') == strlen($file) - 4) {
$file = substr($file, 0, strlen($file) - 4);
}
-
- $destFile = dirname(
- $file
- ) . '/' . \Magento\MediaStorage\Model\File\Uploader::getNewFileName(
- $this->getFilePath($basePath, $file)
- );
+ // phpcs:ignore Magento2.Functions.DiscouragedFunction
+ $destFile = dirname($file) . '/'
+ . Uploader::getNewFileName($this->getFilePath($basePath, $file));
$this->_coreFileStorageDatabase->copyFile(
$this->getFilePath($baseTmpPath, $file),
@@ -180,6 +186,7 @@ public function getFileFromPathFile($pathFile)
/**
* Get filesize in bytes.
+ *
* @param string $file
* @return int
*/
@@ -189,6 +196,8 @@ public function getFileSize($file)
}
/**
+ * Get file type
+ *
* @param string $filePath
* @return string
*/
@@ -199,6 +208,8 @@ public function getFileType($filePath)
}
/**
+ * Get file type by ext
+ *
* @param string $ext
* @return string
*/
@@ -212,6 +223,8 @@ protected function _getFileTypeByExt($ext)
}
/**
+ * Get all file types
+ *
* @return array
*/
public function getAllFileTypes()
@@ -220,6 +233,8 @@ public function getAllFileTypes()
}
/**
+ * Get all mine types
+ *
* @return array
*/
public function getAllMineTypes()
diff --git a/app/code/Magento/Downloadable/Model/File/ContentUploader.php b/app/code/Magento/Downloadable/Model/File/ContentUploader.php
index ab226b40c3cb6..01e721dbb66a4 100644
--- a/app/code/Magento/Downloadable/Model/File/ContentUploader.php
+++ b/app/code/Magento/Downloadable/Model/File/ContentUploader.php
@@ -18,9 +18,9 @@
class ContentUploader extends Uploader implements \Magento\Downloadable\Api\Data\File\ContentUploaderInterface
{
/**
- * Default MIME type
+ * Default MIME type for header "application/octet-stream"
*/
- const DEFAULT_MIME_TYPE = 'application/octet-stream';
+ public const DEFAULT_MIME_TYPE = 'application/octet-stream';
/**
* Filename prefix for temporary files
@@ -79,6 +79,7 @@ public function __construct(
*
* @param ContentInterface $fileContent
* @return array
+ * @phpcs:disable Magento2.Functions.DiscouragedFunction
*/
protected function decodeContent(ContentInterface $fileContent)
{
@@ -105,7 +106,8 @@ protected function getTmpFileName()
}
/**
- * {@inheritdoc}
+ * @inheritdoc
+ * @phpcs:disable Magento2.Functions.DiscouragedFunction
*/
public function upload(ContentInterface $fileContent, $contentType)
{
@@ -118,9 +120,13 @@ public function upload(ContentInterface $fileContent, $contentType)
$this->setAllowRenameFiles(true);
$this->setFilesDispersion(true);
$result = $this->save($this->getDestinationDirectory($contentType));
- unset($result['path']);
- $result['status'] = 'new';
- $result['name'] = substr($result['file'], strrpos($result['file'], '/') + 1);
+
+ if ($result) {
+ unset($result['path']);
+ $result['status'] = 'new';
+ $result['name'] = substr($result['file'], strrpos($result['file'], '/') + 1);
+ }
+
return $result;
}
diff --git a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml
index fb21724130042..29266eeb41671 100644
--- a/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml
+++ b/app/code/Magento/Downloadable/Test/Mftf/ActionGroup/AddDownloadableProductLinkWithMaxDownloadsActionGroup.xml
@@ -25,6 +25,7 @@
+
diff --git a/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml b/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml
index 3a1eb63a96ae1..ff442e9089bb1 100644
--- a/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml
+++ b/app/code/Magento/Downloadable/Test/Mftf/Test/StorefrontAccountDownloadableProductLinkAfterPartialRefundTest.xml
@@ -73,23 +73,27 @@
-
-
-
-
+
+
+
+
+
+
+
-
-
-
+
+
+
+
+
-
-
-
+
+
diff --git a/app/code/Magento/Downloadable/Test/Unit/Helper/FileTest.php b/app/code/Magento/Downloadable/Test/Unit/Helper/FileTest.php
index 11a4422707ed8..5ade044b24298 100644
--- a/app/code/Magento/Downloadable/Test/Unit/Helper/FileTest.php
+++ b/app/code/Magento/Downloadable/Test/Unit/Helper/FileTest.php
@@ -25,15 +25,11 @@ class FileTest extends TestCase
private $file;
/**
- * Core file storage database
- *
* @var Database|MockObject
*/
private $coreFileStorageDatabase;
/**
- * Filesystem object.
- *
* @var \Magento\Framework\Filesystem|MockObject
*/
private $filesystem;
@@ -50,6 +46,14 @@ class FileTest extends TestCase
*/
private $appContext;
+ /**
+ * @var Uploader|MockObject
+ */
+ private $uploader;
+
+ /**
+ * @inheritDoc
+ */
protected function setUp(): void
{
$this->mediaDirectory = $this->getMockBuilder(WriteInterface::class)
@@ -91,21 +95,49 @@ protected function setUp(): void
$this->coreFileStorageDatabase,
$this->filesystem
);
+
+ $this->uploader = $this->getMockBuilder(Uploader::class)
+ ->disableOriginalConstructor()
+ ->getMock();
}
+ /**
+ * @return void
+ */
public function testUploadFromTmp()
{
- $uploaderMock = $this->getMockBuilder(Uploader::class)
- ->disableOriginalConstructor()
- ->getMock();
- $uploaderMock->expects($this->once())->method('setAllowRenameFiles');
- $uploaderMock->expects($this->once())->method('setFilesDispersion');
+ $this->uploader->expects($this->once())->method('setAllowRenameFiles');
+ $this->uploader->expects($this->once())->method('setFilesDispersion');
$this->mediaDirectory->expects($this->once())->method('getAbsolutePath')->willReturn('absPath');
- $uploaderMock->expects($this->once())->method('save')->with('absPath')
+ $this->uploader->expects($this->once())->method('save')->with('absPath')
->willReturn(['file' => 'file.jpg', 'path' => 'absPath']);
- $result = $this->file->uploadFromTmp('tmpPath', $uploaderMock);
+ $result = $this->file->uploadFromTmp('tmpPath', $this->uploader);
$this->assertArrayNotHasKey('path', $result);
}
+
+ /**
+ * @return void
+ */
+ public function testUploadFromTmpSuccess(): void
+ {
+ $tmpPath = __DIR__;
+ $data = ['path' => __DIR__ . DIRECTORY_SEPARATOR . 'media', 'file' => 'test_image.jpg'];
+ $this->uploader->method('save')->willReturn($data);
+ $result = $this->file->uploadFromTmp($tmpPath, $this->uploader);
+ $this->assertEquals('test_image.jpg', $result['file']);
+ $this->assertEquals(1, count($result));
+ }
+
+ /**
+ * @return void
+ */
+ public function testUploadFromTmpFail(): void
+ {
+ $tmpPath = __DIR__;
+ $this->uploader->expects($this->once())->method('save')->willReturn(false);
+ $result = $this->file->uploadFromTmp($tmpPath, $this->uploader);
+ $this->assertEquals(false, $result);
+ }
}
diff --git a/app/code/Magento/Downloadable/composer.json b/app/code/Magento/Downloadable/composer.json
index 866b842f2cfcf..7b668ab581877 100644
--- a/app/code/Magento/Downloadable/composer.json
+++ b/app/code/Magento/Downloadable/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/DownloadableGraphQl/composer.json b/app/code/Magento/DownloadableGraphQl/composer.json
index 5f64b59705436..106998e451354 100644
--- a/app/code/Magento/DownloadableGraphQl/composer.json
+++ b/app/code/Magento/DownloadableGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-store": "*",
"magento/module-catalog": "*",
"magento/module-downloadable": "*",
diff --git a/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithFileLinksTest.xml b/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithFileLinksTest.xml
index 441395e3114a9..8ecff6a1d0c5d 100644
--- a/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithFileLinksTest.xml
+++ b/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithFileLinksTest.xml
@@ -201,17 +201,19 @@
+
+
-
-
+
+
-
+
diff --git a/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithUrlLinksTest.xml b/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithUrlLinksTest.xml
index 22cfca5224ad6..9fa254b877597 100644
--- a/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithUrlLinksTest.xml
+++ b/app/code/Magento/DownloadableImportExport/Test/Mftf/Test/AdminImportDownloadableProductsWithUrlLinksTest.xml
@@ -211,17 +211,19 @@
+
+
-
-
+
+
-
+
diff --git a/app/code/Magento/DownloadableImportExport/composer.json b/app/code/Magento/DownloadableImportExport/composer.json
index 0a639ae1938ab..d8aff6e6db76b 100644
--- a/app/code/Magento/DownloadableImportExport/composer.json
+++ b/app/code/Magento/DownloadableImportExport/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-catalog": "*",
"magento/module-catalog-import-export": "*",
diff --git a/app/code/Magento/Eav/composer.json b/app/code/Magento/Eav/composer.json
index b4598326cb3a7..5206cc2e3bf8c 100644
--- a/app/code/Magento/Eav/composer.json
+++ b/app/code/Magento/Eav/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/EavGraphQl/composer.json b/app/code/Magento/EavGraphQl/composer.json
index 6de95de2ae518..59381c9173517 100644
--- a/app/code/Magento/EavGraphQl/composer.json
+++ b/app/code/Magento/EavGraphQl/composer.json
@@ -3,7 +3,7 @@
"description": "N/A",
"type": "magento2-module",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-eav": "*"
},
diff --git a/app/code/Magento/Elasticsearch/composer.json b/app/code/Magento/Elasticsearch/composer.json
index c0429b2dbc94c..0f117609525dd 100644
--- a/app/code/Magento/Elasticsearch/composer.json
+++ b/app/code/Magento/Elasticsearch/composer.json
@@ -2,7 +2,7 @@
"name": "magento/module-elasticsearch",
"description": "N/A",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/module-advanced-search": "*",
"magento/module-catalog": "*",
"magento/module-catalog-search": "*",
@@ -12,7 +12,7 @@
"magento/module-store": "*",
"magento/module-catalog-inventory": "*",
"magento/framework": "*",
- "elasticsearch/elasticsearch": "~7.15.0"
+ "elasticsearch/elasticsearch": "~7.16.0"
},
"suggest": {
"magento/module-config": "*"
diff --git a/app/code/Magento/Elasticsearch6/composer.json b/app/code/Magento/Elasticsearch6/composer.json
index da969f0173660..4083140e13b96 100644
--- a/app/code/Magento/Elasticsearch6/composer.json
+++ b/app/code/Magento/Elasticsearch6/composer.json
@@ -2,13 +2,13 @@
"name": "magento/module-elasticsearch-6",
"description": "N/A",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-advanced-search": "*",
"magento/module-catalog-search": "*",
"magento/module-search": "*",
"magento/module-elasticsearch": "*",
- "elasticsearch/elasticsearch": "~7.15.0"
+ "elasticsearch/elasticsearch": "~7.16.0"
},
"suggest": {
"magento/module-config": "*"
diff --git a/app/code/Magento/Elasticsearch7/composer.json b/app/code/Magento/Elasticsearch7/composer.json
index ee60b7afb0d18..a41a62d2fa5eb 100644
--- a/app/code/Magento/Elasticsearch7/composer.json
+++ b/app/code/Magento/Elasticsearch7/composer.json
@@ -2,10 +2,10 @@
"name": "magento/module-elasticsearch-7",
"description": "N/A",
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-elasticsearch": "*",
- "elasticsearch/elasticsearch": "~7.15.0",
+ "elasticsearch/elasticsearch": "~7.16.0",
"magento/module-advanced-search": "*",
"magento/module-catalog-search": "*"
},
diff --git a/app/code/Magento/Email/composer.json b/app/code/Magento/Email/composer.json
index bae17e5f6c77b..36c361aa33fea 100644
--- a/app/code/Magento/Email/composer.json
+++ b/app/code/Magento/Email/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-cms": "*",
diff --git a/app/code/Magento/Email/view/adminhtml/web/js/variables.js b/app/code/Magento/Email/view/adminhtml/web/js/variables.js
index 7a671823ace02..a0bfe64795273 100644
--- a/app/code/Magento/Email/view/adminhtml/web/js/variables.js
+++ b/app/code/Magento/Email/view/adminhtml/web/js/variables.js
@@ -133,7 +133,7 @@ define([
}
textareaElm.focus();
textareaElm.scrollTop = scrollPos;
- jQuery(textareaElm).change();
+ jQuery(textareaElm).trigger('change');
textareaElm = null;
}
}
diff --git a/app/code/Magento/EncryptionKey/composer.json b/app/code/Magento/EncryptionKey/composer.json
index bb04bde39861c..828f5d08ac977 100644
--- a/app/code/Magento/EncryptionKey/composer.json
+++ b/app/code/Magento/EncryptionKey/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-config": "*"
diff --git a/app/code/Magento/Fedex/composer.json b/app/code/Magento/Fedex/composer.json
index a98527760e250..aeb3276a03297 100644
--- a/app/code/Magento/Fedex/composer.json
+++ b/app/code/Magento/Fedex/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"lib-libxml": "*",
"magento/framework": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/GiftMessage/Block/Message/Inline.php b/app/code/Magento/GiftMessage/Block/Message/Inline.php
index 475f1c2b717ae..f1993126200fb 100644
--- a/app/code/Magento/GiftMessage/Block/Message/Inline.php
+++ b/app/code/Magento/GiftMessage/Block/Message/Inline.php
@@ -36,8 +36,6 @@ class Inline extends \Magento\Framework\View\Element\Template
protected $_template = 'Magento_GiftMessage::inline.phtml';
/**
- * Gift message message
- *
* @var \Magento\GiftMessage\Helper\Message|null
*/
protected $_giftMessageMessage = null;
@@ -324,7 +322,8 @@ public function getEntityHasMessage()
*/
public function getEscaped($value, $defaultValue = '')
{
- return $this->escapeHtml(trim($value) != '' ? $value : $defaultValue);
+ $value = ($value !== null && trim($value) != '') ? $value : $defaultValue;
+ return $this->escapeHtml($value);
}
/**
diff --git a/app/code/Magento/GiftMessage/Model/GiftMessageManager.php b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php
index 605fd221462d9..dbb285cc0b489 100644
--- a/app/code/Magento/GiftMessage/Model/GiftMessageManager.php
+++ b/app/code/Magento/GiftMessage/Model/GiftMessageManager.php
@@ -25,10 +25,13 @@ public function __construct(
}
/**
+ * Save gift message information.
+ *
* @param array $giftMessages
* @param \Magento\Quote\Model\Quote $quote
* @return $this
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
+ * @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function add($giftMessages, $quote)
{
@@ -61,11 +64,12 @@ public function add($giftMessages, $quote)
$giftMessage->load($entity->getGiftMessageId());
}
- if (trim($message['message']) == '') {
+ if ($message['message'] === null || trim($message['message']) == '') {
if ($giftMessage->getId()) {
try {
$giftMessage->delete();
$entity->setGiftMessageId(0)->save();
+ // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch
} catch (\Exception $e) {
}
}
@@ -84,6 +88,7 @@ public function add($giftMessages, $quote)
)->save();
$entity->setGiftMessageId($giftMessage->getId())->save();
+ // phpcs:ignore Magento2.CodeAnalysis.EmptyBlock.DetectedCatch
} catch (\Exception $e) {
}
}
diff --git a/app/code/Magento/GiftMessage/composer.json b/app/code/Magento/GiftMessage/composer.json
index bfa3f4fe06437..3b29e9cff2b91 100644
--- a/app/code/Magento/GiftMessage/composer.json
+++ b/app/code/Magento/GiftMessage/composer.json
@@ -5,7 +5,7 @@
"sort-packages": true
},
"require": {
- "php": "~7.4.0||~8.0.0",
+ "php": "~7.4.0||~8.0.0||~8.1.0",
"magento/framework": "*",
"magento/module-backend": "*",
"magento/module-catalog": "*",
diff --git a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
index f89657d3c5d90..64ed9a30108c1 100644
--- a/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
+++ b/app/code/Magento/GiftMessage/view/frontend/templates/inline.phtml
@@ -4,7 +4,10 @@
* See COPYING.txt for license details.
*/
+// phpcs:disable Magento2.Files.LineLength, Generic.Files.LineLength
+
/** @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer */
+/** @var Magento\Framework\Escaper $escaper */
?>
getCheckoutType()):
@@ -61,9 +64,7 @@ switch ($block->getCheckoutType()):
name="giftmessage[quote][= (int) $block->getEntity()->getId() ?>][from]"
id="gift-message-whole-from"
title="= $block->escapeHtmlAttr(__('From')) ?>"
- value="= /* @noEscape */ $block
- ->getEscaped($block->getMessage()->getSender(), $block->getDefaultFrom())
- ?>"
+ value="= /* @noEscape */ $block->getEscaped($block->getMessage()->getSender(), $block->getDefaultFrom()) ?>"
class="input-text">
@@ -75,9 +76,8 @@ switch ($block->getCheckoutType()):
+ value="= /* @noEscape */ $block->getEscaped($block->getMessage()->getRecipient(), $block->getDefaultTo()) ?>"
+ class="input-text">