diff --git a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
index d79c42a711565..1d46084020220 100644
--- a/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
+++ b/app/code/Magento/Captcha/view/frontend/web/js/view/checkout/defaultCaptcha.js
@@ -56,7 +56,7 @@ define([
*/
checkCustomerData: function (formId, captchaData, captcha) {
if (!_.isEmpty(captchaData) &&
- !_.isEmpty(captchaData)[formId] &&
+ !_.isEmpty(captchaData[formId]) &&
captchaData[formId].timestamp > captcha.timestamp
) {
if (!captcha.isRequired() && captchaData[formId].isRequired) {
diff --git a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php
index 83a2d1340794c..a0f6fcf315c7f 100644
--- a/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php
+++ b/app/code/Magento/Catalog/Model/Product/Price/SpecialPriceStorage.php
@@ -6,12 +6,22 @@
namespace Magento\Catalog\Model\Product\Price;
+use Magento\Catalog\Api\Data\SpecialPriceInterface;
+use Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory;
+use Magento\Catalog\Api\SpecialPriceStorageInterface;
+use Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor;
+use Magento\Catalog\Model\Product\Price\Validation\Result;
+use Magento\Catalog\Model\ProductIdLocatorInterface;
+use Magento\Framework\App\ObjectManager;
use Magento\Framework\Exception\NoSuchEntityException;
+use Magento\Catalog\Helper\Data;
+use Magento\Store\Api\StoreRepositoryInterface;
/**
* Special price storage presents efficient price API and is used to retrieve, update or delete special prices.
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
-class SpecialPriceStorage implements \Magento\Catalog\Api\SpecialPriceStorageInterface
+class SpecialPriceStorage implements SpecialPriceStorageInterface
{
/**
* @var \Magento\Catalog\Api\SpecialPriceInterface
@@ -19,52 +29,59 @@ class SpecialPriceStorage implements \Magento\Catalog\Api\SpecialPriceStorageInt
private $specialPriceResource;
/**
- * @var \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory
+ * @var SpecialPriceInterfaceFactory
*/
private $specialPriceFactory;
/**
- * @var \Magento\Catalog\Model\ProductIdLocatorInterface
+ * @var ProductIdLocatorInterface
*/
private $productIdLocator;
/**
- * @var \Magento\Store\Api\StoreRepositoryInterface
+ * @var StoreRepositoryInterface
*/
private $storeRepository;
/**
- * @var \Magento\Catalog\Model\Product\Price\Validation\Result
+ * @var Result
*/
private $validationResult;
/**
- * @var \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor
+ * @var InvalidSkuProcessor
*/
private $invalidSkuProcessor;
/**
* @var array
*/
- private $allowedProductTypes = [];
+ private $allowedProductTypes;
+
+ /**
+ * @var Data
+ */
+ private $catalogData;
/**
* @param \Magento\Catalog\Api\SpecialPriceInterface $specialPriceResource
- * @param \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory $specialPriceFactory
- * @param \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator
- * @param \Magento\Store\Api\StoreRepositoryInterface $storeRepository
- * @param \Magento\Catalog\Model\Product\Price\Validation\Result $validationResult
- * @param \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor $invalidSkuProcessor
- * @param array $allowedProductTypes [optional]
+ * @param SpecialPriceInterfaceFactory $specialPriceFactory
+ * @param ProductIdLocatorInterface $productIdLocator
+ * @param StoreRepositoryInterface $storeRepository
+ * @param Result $validationResult
+ * @param InvalidSkuProcessor $invalidSkuProcessor
+ * @param array $allowedProductTypes
+ * @param Data|null $catalogData
*/
public function __construct(
\Magento\Catalog\Api\SpecialPriceInterface $specialPriceResource,
- \Magento\Catalog\Api\Data\SpecialPriceInterfaceFactory $specialPriceFactory,
- \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator,
- \Magento\Store\Api\StoreRepositoryInterface $storeRepository,
- \Magento\Catalog\Model\Product\Price\Validation\Result $validationResult,
- \Magento\Catalog\Model\Product\Price\Validation\InvalidSkuProcessor $invalidSkuProcessor,
- array $allowedProductTypes = []
+ SpecialPriceInterfaceFactory $specialPriceFactory,
+ ProductIdLocatorInterface $productIdLocator,
+ StoreRepositoryInterface $storeRepository,
+ Result $validationResult,
+ InvalidSkuProcessor $invalidSkuProcessor,
+ array $allowedProductTypes = [],
+ ?Data $catalogData = null
) {
$this->specialPriceResource = $specialPriceResource;
$this->specialPriceFactory = $specialPriceFactory;
@@ -73,10 +90,11 @@ public function __construct(
$this->validationResult = $validationResult;
$this->invalidSkuProcessor = $invalidSkuProcessor;
$this->allowedProductTypes = $allowedProductTypes;
+ $this->catalogData = $catalogData ?: ObjectManager::getInstance()->get(Data::class);
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function get(array $skus)
{
@@ -85,7 +103,7 @@ public function get(array $skus)
$prices = [];
foreach ($rawPrices as $rawPrice) {
- /** @var \Magento\Catalog\Api\Data\SpecialPriceInterface $price */
+ /** @var SpecialPriceInterface $price */
$price = $this->specialPriceFactory->create();
$sku = isset($rawPrice['sku'])
? $rawPrice['sku']
@@ -102,7 +120,7 @@ public function get(array $skus)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function update(array $prices)
{
@@ -113,7 +131,7 @@ public function update(array $prices)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function delete(array $prices)
{
@@ -140,52 +158,14 @@ private function retrieveValidPrices(array $prices)
foreach ($prices as $key => $price) {
if (!$price->getSku() || in_array($price->getSku(), $failedSkus)) {
- $this->validationResult->addFailedItem(
- $key,
- __(
- 'The product that was requested doesn\'t exist. Verify the product and try again. '
- . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.',
- [
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- ),
- [
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- );
+ $errorMessage = 'The product that was requested doesn\'t exist. Verify the product and try again. '
+ . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
+ $this->addFailedItemPrice($price, $key, $errorMessage, []);
}
+ $this->checkStore($price, $key);
$this->checkPrice($price, $key);
$this->checkDate($price, $price->getPriceFrom(), 'Price From', $key);
$this->checkDate($price, $price->getPriceTo(), 'Price To', $key);
- try {
- $this->storeRepository->getById($price->getStoreId());
- } catch (NoSuchEntityException $e) {
- $this->validationResult->addFailedItem(
- $key,
- __(
- 'Requested store is not found. '
- . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.',
- [
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- ),
- [
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- );
- }
}
foreach ($this->validationResult->getFailedRowIds() as $id) {
@@ -195,77 +175,95 @@ private function retrieveValidPrices(array $prices)
return $prices;
}
+ /**
+ * Check that store exists and is global when price scope is global and otherwise add error to aggregator.
+ *
+ * @param SpecialPriceInterface $price
+ * @param int $key
+ * @return void
+ */
+ private function checkStore(SpecialPriceInterface $price, int $key): void
+ {
+ if ($this->catalogData->isPriceGlobal() && $price->getStoreId() !== 0) {
+ $errorMessage = 'Could not change non global Price when price scope is global. '
+ . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
+ $this->addFailedItemPrice($price, $key, $errorMessage, []);
+ }
+
+ try {
+ $this->storeRepository->getById($price->getStoreId());
+ } catch (NoSuchEntityException $e) {
+ $errorMessage = 'Requested store is not found. '
+ . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
+ $this->addFailedItemPrice($price, $key, $errorMessage, []);
+ }
+ }
+
/**
* Check that date value is correct and add error to aggregator if it contains incorrect data.
*
- * @param \Magento\Catalog\Api\Data\SpecialPriceInterface $price
+ * @param SpecialPriceInterface $price
* @param string $value
* @param string $label
* @param int $key
* @return void
*/
- private function checkDate(\Magento\Catalog\Api\Data\SpecialPriceInterface $price, $value, $label, $key)
+ private function checkDate(SpecialPriceInterface $price, $value, $label, $key)
{
if ($value && !$this->isCorrectDateValue($value)) {
- $this->validationResult->addFailedItem(
- $key,
- __(
- 'Invalid attribute %label = %priceTo. '
- . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.',
- [
- 'label' => $label,
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- ),
- [
- 'label' => $label,
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- );
+ $errorMessage = 'Invalid attribute %label = %priceTo. '
+ . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
+ $this->addFailedItemPrice($price, $key, $errorMessage, ['label' => $label]);
}
}
/**
- * Check that provided price value is not empty and not lower then zero and add error to aggregator if price
+ * Check price.
+ *
+ * Verify that provided price value is not empty and not lower then zero and add error to aggregator if price
* contains not valid data.
*
- * @param \Magento\Catalog\Api\Data\SpecialPriceInterface $price
+ * @param SpecialPriceInterface $price
* @param int $key
* @return void
*/
- private function checkPrice(\Magento\Catalog\Api\Data\SpecialPriceInterface $price, $key)
+ private function checkPrice(SpecialPriceInterface $price, int $key): void
{
if (null === $price->getPrice() || $price->getPrice() < 0) {
- $this->validationResult->addFailedItem(
- $key,
- __(
- 'Invalid attribute Price = %price. '
- . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.',
- [
- 'price' => $price->getPrice(),
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- ),
- [
- 'price' => $price->getPrice(),
- 'SKU' => $price->getSku(),
- 'storeId' => $price->getStoreId(),
- 'priceFrom' => $price->getPriceFrom(),
- 'priceTo' => $price->getPriceTo()
- ]
- );
+ $errorMessage = 'Invalid attribute Price = %price. '
+ . 'Row ID: SKU = %SKU, Store ID: %storeId, Price From: %priceFrom, Price To: %priceTo.';
+ $this->addFailedItemPrice($price, $key, $errorMessage, ['price' => $price->getPrice()]);
}
}
+ /**
+ * Adds failed item price to validation result
+ *
+ * @param SpecialPriceInterface $price
+ * @param int $key
+ * @param string $message
+ * @param array $firstParam
+ * @return void
+ */
+ private function addFailedItemPrice(
+ SpecialPriceInterface $price,
+ int $key,
+ string $message,
+ array $firstParam
+ ): void {
+ $additionalInfo = [];
+ if ($firstParam) {
+ $additionalInfo = array_merge($additionalInfo, $firstParam);
+ }
+
+ $additionalInfo['SKU'] = $price->getSku();
+ $additionalInfo['storeId'] = $price->getStoreId();
+ $additionalInfo['priceFrom'] = $price->getPriceFrom();
+ $additionalInfo['priceTo'] = $price->getPriceTo();
+
+ $this->validationResult->addFailedItem($key, __($message, $additionalInfo), $additionalInfo);
+ }
+
/**
* Retrieve SKU by product ID.
*
diff --git a/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php b/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php
index 7eb19193f8bdd..448b3769c7157 100644
--- a/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php
+++ b/app/code/Magento/Catalog/Model/ResourceModel/Product/Price/SpecialPrice.php
@@ -6,10 +6,18 @@
namespace Magento\Catalog\Model\ResourceModel\Product\Price;
+use Magento\Catalog\Api\ProductAttributeRepositoryInterface;
+use Magento\Catalog\Api\SpecialPriceInterface;
+use Magento\Catalog\Model\ProductIdLocatorInterface;
+use Magento\Catalog\Model\ResourceModel\Attribute;
+use Magento\Framework\EntityManager\MetadataPool;
+use Magento\Framework\Exception\CouldNotDeleteException;
+use Magento\Framework\App\ObjectManager;
+
/**
* Special price resource.
*/
-class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface
+class SpecialPrice implements SpecialPriceInterface
{
/**
* Price storage table.
@@ -26,24 +34,24 @@ class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface
private $datetimeTable = 'catalog_product_entity_datetime';
/**
- * @var \Magento\Catalog\Model\ResourceModel\Attribute
+ * @var Attribute
*/
private $attributeResource;
/**
- * @var \Magento\Catalog\Api\ProductAttributeRepositoryInterface
+ * @var ProductAttributeRepositoryInterface
*/
private $attributeRepository;
/**
- * @var \Magento\Catalog\Model\ProductIdLocatorInterface
+ * @var ProductIdLocatorInterface
*/
private $productIdLocator;
/**
* Metadata pool.
*
- * @var \Magento\Framework\EntityManager\MetadataPool
+ * @var MetadataPool
*/
private $metadataPool;
@@ -76,16 +84,16 @@ class SpecialPrice implements \Magento\Catalog\Api\SpecialPriceInterface
private $itemsPerOperation = 500;
/**
- * @param \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource
- * @param \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository
- * @param \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator
- * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
+ * @param Attribute $attributeResource
+ * @param ProductAttributeRepositoryInterface $attributeRepository
+ * @param ProductIdLocatorInterface $productIdLocator
+ * @param MetadataPool $metadataPool
*/
public function __construct(
- \Magento\Catalog\Model\ResourceModel\Attribute $attributeResource,
- \Magento\Catalog\Api\ProductAttributeRepositoryInterface $attributeRepository,
- \Magento\Catalog\Model\ProductIdLocatorInterface $productIdLocator,
- \Magento\Framework\EntityManager\MetadataPool $metadataPool
+ Attribute $attributeResource,
+ ProductAttributeRepositoryInterface $attributeRepository,
+ ProductIdLocatorInterface $productIdLocator,
+ MetadataPool $metadataPool
) {
$this->attributeResource = $attributeResource;
$this->attributeRepository = $attributeRepository;
@@ -94,7 +102,7 @@ public function __construct(
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function get(array $skus)
{
@@ -132,7 +140,7 @@ public function get(array $skus)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function update(array $prices)
{
@@ -187,49 +195,63 @@ public function update(array $prices)
}
/**
- * {@inheritdoc}
+ * @inheritdoc
*/
public function delete(array $prices)
{
- $skus = array_unique(
- array_map(function ($price) {
- return $price->getSku();
- }, $prices)
- );
- $ids = $this->retrieveAffectedIds($skus);
$connection = $this->attributeResource->getConnection();
- $connection->beginTransaction();
- try {
- foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) {
- $this->attributeResource->getConnection()->delete(
- $this->attributeResource->getTable($this->priceTable),
- [
- 'attribute_id = ?' => $this->getPriceAttributeId(),
- $this->getEntityLinkField() . ' IN (?)' => $idsBunch
- ]
- );
- }
- foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) {
- $this->attributeResource->getConnection()->delete(
- $this->attributeResource->getTable($this->datetimeTable),
- [
- 'attribute_id IN (?)' => [$this->getPriceFromAttributeId(), $this->getPriceToAttributeId()],
- $this->getEntityLinkField() . ' IN (?)' => $idsBunch
- ]
- );
+
+ foreach ($this->getStoreSkus($prices) as $storeId => $skus) {
+
+ $ids = $this->retrieveAffectedIds(array_unique($skus));
+ $connection->beginTransaction();
+ try {
+ foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) {
+ $connection->delete(
+ $this->attributeResource->getTable($this->priceTable),
+ [
+ 'attribute_id = ?' => $this->getPriceAttributeId(),
+ 'store_id = ?' => $storeId,
+ $this->getEntityLinkField() . ' IN (?)' => $idsBunch
+ ]
+ );
+ }
+ foreach (array_chunk($ids, $this->itemsPerOperation) as $idsBunch) {
+ $connection->delete(
+ $this->attributeResource->getTable($this->datetimeTable),
+ [
+ 'attribute_id IN (?)' => [$this->getPriceFromAttributeId(), $this->getPriceToAttributeId()],
+ 'store_id = ?' => $storeId,
+ $this->getEntityLinkField() . ' IN (?)' => $idsBunch
+ ]
+ );
+ }
+ $connection->commit();
+ } catch (\Exception $e) {
+ $connection->rollBack();
+ throw new CouldNotDeleteException(__('Could not delete Prices'), $e);
}
- $connection->commit();
- } catch (\Exception $e) {
- $connection->rollBack();
- throw new \Magento\Framework\Exception\CouldNotDeleteException(
- __('Could not delete Prices'),
- $e
- );
}
return true;
}
+ /**
+ * Returns associative arrays of store_id as key and array of skus as value.
+ *
+ * @param \Magento\Catalog\Api\Data\SpecialPriceInterface[] $priceItems
+ * @return array
+ */
+ private function getStoreSkus(array $priceItems): array
+ {
+ $storeSkus = [];
+ foreach ($priceItems as $priceItem) {
+ $storeSkus[$priceItem->getStoreId()][] = $priceItem->getSku();
+ }
+
+ return $storeSkus;
+ }
+
/**
* Get link field.
*
@@ -312,9 +334,9 @@ private function retrieveAffectedIds(array $skus)
$affectedIds = [];
foreach ($this->productIdLocator->retrieveProductIdsBySkus($skus) as $productIds) {
- $affectedIds = array_merge($affectedIds, array_keys($productIds));
+ $affectedIds[] = array_keys($productIds);
}
- return array_unique($affectedIds);
+ return array_unique(array_merge([], ...$affectedIds));
}
}
diff --git a/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php b/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php
index 5e7039912999b..f74d8ca358b3f 100644
--- a/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php
+++ b/app/code/Magento/CatalogUrlRewrite/Setup/Patch/Data/UpdateUrlKeyForProducts.php
@@ -34,19 +34,27 @@ class UpdateUrlKeyForProducts implements DataPatchInterface, PatchVersionInterfa
*/
private $urlProduct;
+ /**
+ * @var \Magento\Framework\EntityManager\MetadataPool
+ */
+ private $metadataPool;
+
/**
* @param ModuleDataSetupInterface $moduleDataSetup
* @param EavSetupFactory $eavSetupFactory
* @param Url $urlProduct
+ * @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup,
EavSetupFactory $eavSetupFactory,
- Url $urlProduct
+ Url $urlProduct,
+ \Magento\Framework\EntityManager\MetadataPool $metadataPool
) {
$this->moduleDataSetup = $moduleDataSetup;
$this->eavSetup = $eavSetupFactory->create(['setup' => $moduleDataSetup]);
$this->urlProduct = $urlProduct;
+ $this->metadataPool = $metadataPool;
}
/**
@@ -58,7 +66,7 @@ public function apply()
$table = $this->moduleDataSetup->getTable('catalog_product_entity_varchar');
$select = $this->moduleDataSetup->getConnection()->select()->from(
$table,
- ['value_id', 'value']
+ [$this->getProductLinkField(), 'attribute_id', 'store_id', 'value_id', 'value']
)->where(
'attribute_id = ?',
$this->eavSetup->getAttributeId($productTypeId, 'url_key')
@@ -99,4 +107,17 @@ public function getAliases()
{
return [];
}
+
+ /**
+ * Return product id field name - entity_id|row_id
+ *
+ * @return string
+ * @throws \Exception
+ */
+ private function getProductLinkField()
+ {
+ return $this->metadataPool
+ ->getMetadata(\Magento\Catalog\Api\Data\ProductInterface::class)
+ ->getLinkField();
+ }
}
diff --git a/app/code/Magento/Cms/Model/Page/DataProvider.php b/app/code/Magento/Cms/Model/Page/DataProvider.php
index 41010575a1f27..6afde01cfe6c6 100644
--- a/app/code/Magento/Cms/Model/Page/DataProvider.php
+++ b/app/code/Magento/Cms/Model/Page/DataProvider.php
@@ -5,24 +5,24 @@
*/
namespace Magento\Cms\Model\Page;
-use Magento\Cms\Model\Page;
+use Magento\Cms\Api\Data\PageInterface;
+use Magento\Cms\Api\PageRepositoryInterface;
+use Magento\Cms\Model\PageFactory;
use Magento\Cms\Model\ResourceModel\Page\CollectionFactory;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\App\Request\DataPersistorInterface;
use Magento\Framework\App\RequestInterface;
-use Magento\Ui\DataProvider\Modifier\PoolInterface;
use Magento\Framework\AuthorizationInterface;
+use Magento\Framework\Exception\LocalizedException;
+use Magento\Ui\DataProvider\Modifier\PoolInterface;
+use Magento\Ui\DataProvider\ModifierPoolDataProvider;
+use Psr\Log\LoggerInterface;
/**
- * Class DataProvider
+ * Cms Page DataProvider
*/
-class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider
+class DataProvider extends ModifierPoolDataProvider
{
- /**
- * @var \Magento\Cms\Model\ResourceModel\Page\Collection
- */
- protected $collection;
-
/**
* @var DataPersistorInterface
*/
@@ -33,6 +33,11 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider
*/
protected $loadedData;
+ /**
+ * @var PageRepositoryInterface
+ */
+ private $pageRepository;
+
/**
* @var AuthorizationInterface
*/
@@ -49,9 +54,14 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider
private $customLayoutManager;
/**
- * @var CollectionFactory
+ * @var PageFactory
+ */
+ private $pageFactory;
+
+ /**
+ * @var LoggerInterface
*/
- private $collectionFactory;
+ private $logger;
/**
* @param string $name
@@ -65,6 +75,9 @@ class DataProvider extends \Magento\Ui\DataProvider\ModifierPoolDataProvider
* @param AuthorizationInterface|null $auth
* @param RequestInterface|null $request
* @param CustomLayoutManagerInterface|null $customLayoutManager
+ * @param PageRepositoryInterface|null $pageRepository
+ * @param PageFactory|null $pageFactory
+ * @param LoggerInterface|null $logger
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
*/
public function __construct(
@@ -78,33 +91,22 @@ public function __construct(
PoolInterface $pool = null,
?AuthorizationInterface $auth = null,
?RequestInterface $request = null,
- ?CustomLayoutManagerInterface $customLayoutManager = null
+ ?CustomLayoutManagerInterface $customLayoutManager = null,
+ ?PageRepositoryInterface $pageRepository = null,
+ ?PageFactory $pageFactory = null,
+ ?LoggerInterface $logger = null
) {
+ parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool);
$this->collection = $pageCollectionFactory->create();
- $this->collectionFactory = $pageCollectionFactory;
$this->dataPersistor = $dataPersistor;
- parent::__construct($name, $primaryFieldName, $requestFieldName, $meta, $data, $pool);
$this->auth = $auth ?? ObjectManager::getInstance()->get(AuthorizationInterface::class);
$this->meta = $this->prepareMeta($this->meta);
$this->request = $request ?? ObjectManager::getInstance()->get(RequestInterface::class);
$this->customLayoutManager = $customLayoutManager
?? ObjectManager::getInstance()->get(CustomLayoutManagerInterface::class);
- }
-
- /**
- * Find requested page.
- *
- * @return Page|null
- */
- private function findCurrentPage(): ?Page
- {
- if ($this->getRequestFieldName() && ($pageId = (int)$this->request->getParam($this->getRequestFieldName()))) {
- //Loading data for the collection.
- $this->getData();
- return $this->collection->getItemById($pageId);
- }
-
- return null;
+ $this->pageRepository = $pageRepository ?? ObjectManager::getInstance()->get(PageRepositoryInterface::class);
+ $this->pageFactory = $pageFactory ?: ObjectManager::getInstance()->get(PageFactory::class);
+ $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class);
}
/**
@@ -128,29 +130,53 @@ public function getData()
if (isset($this->loadedData)) {
return $this->loadedData;
}
- $this->collection = $this->collectionFactory->create();
- $items = $this->collection->getItems();
- /** @var $page \Magento\Cms\Model\Page */
- foreach ($items as $page) {
- $this->loadedData[$page->getId()] = $page->getData();
- if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
- //Deprecated layout update exists.
- $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_';
+
+ $page = $this->getCurrentPage();
+ $this->loadedData[$page->getId()] = $page->getData();
+ if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
+ //Deprecated layout update exists.
+ $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_';
+ }
+
+ return $this->loadedData;
+ }
+
+ /**
+ * Return current page
+ *
+ * @return PageInterface
+ */
+ private function getCurrentPage(): PageInterface
+ {
+ $pageId = $this->getPageId();
+ if ($pageId) {
+ try {
+ $page = $this->pageRepository->getById($pageId);
+ } catch (LocalizedException $exception) {
+ $page = $this->pageFactory->create();
}
+
+ return $page;
}
$data = $this->dataPersistor->get('cms_page');
- if (!empty($data)) {
- $page = $this->collection->getNewEmptyItem();
- $page->setData($data);
- $this->loadedData[$page->getId()] = $page->getData();
- if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
- $this->loadedData[$page->getId()]['layout_update_selected'] = '_existing_';
- }
- $this->dataPersistor->clear('cms_page');
+ if (empty($data)) {
+ return $this->pageFactory->create();
}
+ $this->dataPersistor->clear('cms_page');
- return $this->loadedData;
+ return $this->pageFactory->create()
+ ->setData($data);
+ }
+
+ /**
+ * Returns current page id from request
+ *
+ * @return int
+ */
+ private function getPageId(): int
+ {
+ return (int) $this->request->getParam($this->getRequestFieldName());
}
/**
@@ -186,16 +212,20 @@ public function getMeta()
//List of custom layout files available for current page.
$options = [['label' => 'No update', 'value' => '_no_update_']];
- if ($page = $this->findCurrentPage()) {
- //We must have a specific page selected.
- //If custom layout XML is set then displaying this special option.
+
+ $page = null;
+ try {
+ $page = $this->pageRepository->getById($this->getPageId());
if ($page->getCustomLayoutUpdateXml() || $page->getLayoutUpdateXml()) {
$options[] = ['label' => 'Use existing layout update XML', 'value' => '_existing_'];
}
foreach ($this->customLayoutManager->fetchAvailableFiles($page) as $layoutFile) {
$options[] = ['label' => $layoutFile, 'value' => $layoutFile];
}
+ } catch (LocalizedException $e) {
+ $this->logger->error($e->getMessage());
}
+
$customLayoutMeta = [
'design' => [
'children' => [
diff --git a/app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml b/app/code/Magento/Cms/view/frontend/layout/cms_noroute_index.xml
similarity index 100%
rename from app/code/Magento/Cms/view/frontend/layout/cms_index_noroute.xml
rename to app/code/Magento/Cms/view/frontend/layout/cms_noroute_index.xml
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml
new file mode 100644
index 0000000000000..cbe227c1809f3
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickPrintOrderLinkOnViewOrderPageActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Clicks the "Print Order" link on the My Account->My Orders->Order View page
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml
new file mode 100644
index 0000000000000..232667cd9a8e5
--- /dev/null
+++ b/app/code/Magento/Customer/Test/Mftf/ActionGroup/StorefrontClickViewOrderLinkOnMyOrdersPageActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Clicks the top "View Order" link on the My Account->My Orders page
+
+
+
+
+
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
index 5b6c4fd23e038..dd8b576ad7bb7 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminCreateCustomerTest.xml
@@ -21,9 +21,7 @@
-
-
-
+
@@ -40,9 +38,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml
index 62dcd6fc4d894..b3d432b7776aa 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml
index c6e72901b062c..15eae933ccdda 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteCustomerAddressesFromTheGridViaMassActionsTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml
index 52c8029b8f778..55c9315f42fa9 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminDeleteDefaultBillingCustomerAddressTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml
index 77422c6e8da3f..b975cf62765c1 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminPanelIsFrozenIfStorefrontIsOpenedViaCustomerViewTest.xml
@@ -6,7 +6,8 @@
*/
-->
-
+
@@ -23,37 +24,41 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -61,12 +66,11 @@
-
-
-
+
+
+
-
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
index 257d4c9b2e3c2..4ffb59dd7c658 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminResetCustomerPasswordTest.xml
@@ -25,9 +25,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml
index bac1c665cbe78..7a9743482f81e 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminSearchCustomerAddressByKeywordTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml
index 3f95e55c56132..3fa29aef9908e 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminDeleteCustomerAddressTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml
index fb6793b1751a6..971a93f64d800 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AdminUpdateCustomerTest/AdminUpdateCustomerInfoFromDefaultToNonDefaultTest.xml
@@ -20,9 +20,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml
index 6a157c6312530..34cd34425815a 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/AllowedCountriesRestrictionApplyOnBackendTest.xml
@@ -42,9 +42,7 @@
-
-
-
+
@@ -62,9 +60,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml
index 130e1ba6723ae..9371a51e7770f 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontClearAllCompareProductsTest.xml
@@ -102,9 +102,7 @@
-
-
-
+
diff --git a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
index 47b61b332f571..148afb6d67c21 100644
--- a/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
+++ b/app/code/Magento/Customer/Test/Mftf/Test/StorefrontCreateCustomerWithDateOfBirthTest.xml
@@ -36,7 +36,7 @@
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml
index a909582c32b3d..16a3ad59b5494 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdminAssociateGroupedProductToWebsitesTest.xml
@@ -51,11 +51,7 @@
-
-
-
-
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml
index 4aa4e99e79489..b4a3bb88d2e28 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByDescriptionTest.xml
@@ -30,9 +30,7 @@
-
-
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml
index 06dde74de20f9..0e620992ad6be 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByNameTest.xml
@@ -30,9 +30,7 @@
-
-
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml
index 66e1b60331e97..79691face4911 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByPriceTest.xml
@@ -39,9 +39,7 @@
-
-
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml
index 79b465abe2ac6..2d7c2aee05cb0 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductByShortDescriptionTest.xml
@@ -30,9 +30,7 @@
-
-
-
+
diff --git a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml
index c196abbce99ed..5142558eaff66 100644
--- a/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml
+++ b/app/code/Magento/GroupedProduct/Test/Mftf/Test/AdvanceCatalogSearchGroupedProductTest/AdvanceCatalogSearchGroupedProductBySkuTest.xml
@@ -29,9 +29,7 @@
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml
new file mode 100644
index 0000000000000..fe24996ba2834
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Mftf/ActionGroup/AdminClickCreateNewStatusButtonOnOrderStatusPageActionGroup.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+ Click create new status button
+
+
+
+
+
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml
index 7d6e2048c9432..9c99b3140bc0c 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithCheckMoneyOrderPaymentMethodTest.xml
@@ -94,9 +94,7 @@
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml
index 9f09a59fa8d5e..9680cbd1e289a 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCancelTheCreatedOrderWithPurchaseOrderPaymentMethodTest.xml
@@ -35,9 +35,7 @@
10.00
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml
index 33bc1a39ca11a..fa11b567fee95 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCorrectnessInvoicedItemInBundleProductTest.xml
@@ -57,10 +57,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml
index 5c61a8b089b97..f3ce8106c2730 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingCodeTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml
index 84bda226c9512..f8e7be5fdb5b6 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusDuplicatingLabelTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml
index f4ad885429189..c5fc6170d2782 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminCreateOrderStatusTest.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml
new file mode 100644
index 0000000000000..2671cd6989c51
--- /dev/null
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelClosedAndProcessingTest.xml
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml
index 6eb4195524224..3400e07373f54 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersCancelProcessingAndClosedTest.xml
@@ -8,15 +8,18 @@
-
+
-
+
+
+ Use AdminMassOrdersCancelClosedAndProcessingTest instead
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml
index 41964cbf605da..592c8b7981bed 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersHoldOnCompleteTest.xml
@@ -21,7 +21,6 @@
-
@@ -29,43 +28,49 @@
-
-
-
-
-
-
-
-
- $getOrderId
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
-
-
+
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml
index 163da4917b50a..e8b842a48890e 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminMassOrdersUpdateCancelPendingOrderTest.xml
@@ -20,7 +20,6 @@
-
@@ -28,40 +27,43 @@
-
-
-
-
-
-
-
-
- $getOrderId
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
-
-
+
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml
index 4799984b76745..f24ac5c587913 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminReorderWithCatalogPriceRuleDiscountTest.xml
@@ -29,9 +29,7 @@
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml
index 0224bca9d96ac..814be5ccd86bf 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AdminUnassignCustomOrderStatusTest.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml
index 861a5a5bf42df..ac17d41c43c3d 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/AssignCustomOrderStatusNotVisibleOnStorefrontTest.xml
@@ -49,7 +49,7 @@
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml
index 08d5776b79ea0..32668bc5c857d 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/CreateOrderFromEditCustomerPageTest.xml
@@ -75,9 +75,7 @@
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml
index 452d65ea5ae57..850dd9e1b5795 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/MoveRecentlyViewedBundleFixedProductOnOrderPageTest.xml
@@ -57,9 +57,7 @@
-
-
-
+
diff --git a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml
index 6b6b0b2ef4a16..8e41247a37b54 100644
--- a/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml
+++ b/app/code/Magento/Sales/Test/Mftf/Test/StorefrontOrderPagerDisplayedTest.xml
@@ -89,10 +89,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml
index 8df45937bb542..7e5daa3d31ddb 100644
--- a/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml
+++ b/app/code/Magento/SalesRule/Test/Mftf/Test/StorefrontCartTotalValueWithFullDiscountUsingCartRuleTest.xml
@@ -56,9 +56,7 @@
5.50
-
-
-
+
diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml
index 8c468cce91829..ce2a9a7691fbb 100644
--- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml
+++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductDescriptionTest.xml
@@ -23,10 +23,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml
index fb1f35730fd80..57fc8fbf343c1 100644
--- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml
+++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductNameTest.xml
@@ -25,10 +25,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml
index 1558f9aa5342b..567f88c0d612c 100644
--- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml
+++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductShortDescriptionTest.xml
@@ -25,10 +25,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml
index 19c12843c23a2..1f9213ced0144 100644
--- a/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml
+++ b/app/code/Magento/Search/Test/Mftf/Test/StorefrontVerifySearchSuggestionByProductSkuTest.xml
@@ -25,10 +25,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml
index 0d709e1d08006..de45cbf9bb2fe 100644
--- a/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml
+++ b/app/code/Magento/Shipping/Test/Mftf/Test/AdminValidateShippingTrackingNumberTest.xml
@@ -19,6 +19,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -26,12 +42,11 @@
-
-
-
-
-
-
+
+
+
+
+
diff --git a/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
index 442ee99e12793..3219877cc6426 100644
--- a/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
+++ b/app/code/Magento/Store/Test/Mftf/Test/StorefrontCheckSortOrderStoreViewTest.xml
@@ -38,9 +38,7 @@
-
-
-
+
diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml
index b661ecb338bde..91b918714a9c4 100644
--- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml
+++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontDisplayAllCharactersOnTextSwatchTest.xml
@@ -29,10 +29,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml
index 4ed8824d9e39b..159b57f3a39f8 100644
--- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml
+++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByImageSwatchTest.xml
@@ -103,10 +103,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml
index 4a78b4380fb68..a7aff1a7c89ff 100644
--- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml
+++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByTextSwatchTest.xml
@@ -80,10 +80,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml
index 2a986463a3d14..902d1a8f21c33 100644
--- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml
+++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontFilterByVisualSwatchTest.xml
@@ -92,10 +92,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml
index 734294ba977ba..f7211d9ef8516 100644
--- a/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml
+++ b/app/code/Magento/Swatches/Test/Mftf/Test/StorefrontImageColorWhenFilterByColorFilterTest.xml
@@ -70,10 +70,7 @@
-
-
-
-
+
diff --git a/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml
new file mode 100644
index 0000000000000..1c2c72a661ce1
--- /dev/null
+++ b/app/code/Magento/Tax/Test/Mftf/ActionGroup/AdminFillTaxIdentifierFilterOnTaxRateGridActionGroup.xml
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+ Fill the Filter By Tax Identifier field with taxRateCode.
+
+
+
+
+
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml
index 7fa1daeb063ca..0ede3caacd867 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateAllPostCodesTest.xml
@@ -44,7 +44,9 @@
-
+
+
+
@@ -55,7 +57,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml
index e189e45483197..cb597273e36b6 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateLargeRateTest.xml
@@ -46,7 +46,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml
index 9a5566c2db881..46d3582681c56 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateSpecificPostcodeTest.xml
@@ -46,7 +46,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml
index 48217628b927a..f428aabddcf9a 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateWiderZipCodeRangeTest.xml
@@ -46,7 +46,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml
index d237e52a60472..0e541b8939053 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/AdminCreateTaxRateZipCodeRangeTest.xml
@@ -47,7 +47,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml
index 3abdb45faf95a..5f288d55b5d05 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/DeleteTaxRateEntityTest.xml
@@ -37,7 +37,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml
index b102b4d945019..6f7ef59788f68 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/Update01TaxRateEntityTest.xml
@@ -29,7 +29,9 @@
-
+
+
+
@@ -46,7 +48,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml
index 115a1df4631e5..c7663acf97a14 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/Update100TaxRateEntityTest.xml
@@ -29,7 +29,9 @@
-
+
+
+
@@ -45,7 +47,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml
index 5594cf58e7b21..5776925354e80 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/Update1299TaxRateEntityTest.xml
@@ -29,7 +29,9 @@
-
+
+
+
@@ -46,7 +48,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml
index da531ea373aa1..c4449e5d6e5ad 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateAnyRegionTaxRateEntityTest.xml
@@ -29,7 +29,10 @@
-
+
+
+
+
@@ -45,7 +48,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml
index 717d9b9428267..2bac4ca2115c0 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateDecimalTaxRateEntityTest.xml
@@ -29,7 +29,9 @@
-
+
+
+
@@ -47,7 +49,9 @@
-
+
+
+
diff --git a/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml b/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml
index b664d334162ed..c808de2d7f10d 100644
--- a/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml
+++ b/app/code/Magento/Tax/Test/Mftf/Test/UpdateLargeTaxRateEntityTest.xml
@@ -29,7 +29,10 @@
-
+
+
+
+
@@ -44,7 +47,9 @@
-
+
+
+
diff --git a/app/code/Magento/Theme/etc/frontend/di.xml b/app/code/Magento/Theme/etc/frontend/di.xml
index 35eb9d4f8b53c..f0b7f19911e12 100644
--- a/app/code/Magento/Theme/etc/frontend/di.xml
+++ b/app/code/Magento/Theme/etc/frontend/di.xml
@@ -27,7 +27,7 @@
-
+
diff --git a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php
index 90fe075f91e30..a1e338fc304db 100644
--- a/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php
+++ b/dev/tests/api-functional/testsuite/Magento/Catalog/Api/SpecialPriceStorageTest.php
@@ -6,17 +6,20 @@
namespace Magento\Catalog\Api;
use Magento\Catalog\Api\Data\ProductInterface;
+use Magento\Catalog\Model\ResourceModel\Product as ProductResource;
use Magento\Framework\Exception\CouldNotSaveException;
use Magento\Framework\Exception\InputException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\StateException;
use Magento\Framework\Webapi\Rest\Request;
+use Magento\Store\Model\StoreManagerInterface;
use Magento\TestFramework\Helper\Bootstrap;
use Magento\TestFramework\ObjectManager;
use Magento\TestFramework\TestCase\WebapiAbstract;
/**
* SpecialPriceStorage API operations test
+ * @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class SpecialPriceStorageTest extends WebapiAbstract
{
@@ -24,6 +27,7 @@ class SpecialPriceStorageTest extends WebapiAbstract
const SERVICE_VERSION = 'V1';
const SIMPLE_PRODUCT_SKU = 'simple';
const VIRTUAL_PRODUCT_SKU = 'virtual-product';
+ private const PRODUCT_SKU_TWO_WEBSITES = 'simple-on-two-websites';
/**
* @var ObjectManager
@@ -31,11 +35,23 @@ class SpecialPriceStorageTest extends WebapiAbstract
private $objectManager;
/**
- * Set up.
+ * @var ProductResource
+ */
+ private $productResource;
+
+ /**
+ * @var StoreManagerInterface
+ */
+ private $storeManager;
+
+ /**
+ * @ingeritdoc
*/
protected function setUp(): void
{
$this->objectManager = Bootstrap::getObjectManager();
+ $this->productResource = $this->objectManager->get(ProductResource::class);
+ $this->storeManager = $this->objectManager->get(StoreManagerInterface::class);
}
/**
@@ -128,6 +144,49 @@ public function testUpdate(array $data)
$this->assertEmpty($response);
}
+ /**
+ * Delete special price for specified store when price scope is global
+ *
+ * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php
+ *
+ * @return void
+ */
+ public function testDeleteWhenPriceIsGlobal(): void
+ {
+ $serviceInfo = [
+ 'rest' => [
+ 'resourcePath' => '/V1/products/special-price-delete',
+ 'httpMethod' => Request::HTTP_METHOD_POST
+ ],
+ 'soap' => [
+ 'service' => self::SERVICE_NAME,
+ 'serviceVersion' => self::SERVICE_VERSION,
+ 'operation' => self::SERVICE_NAME . 'Delete',
+ ],
+ ];
+
+ $response = $this->_webApiCall(
+ $serviceInfo,
+ [
+ 'prices' => [
+ [
+ 'price' => 777,
+ 'store_id' => 1,
+ 'sku' => self::SIMPLE_PRODUCT_SKU,
+ 'price_from' => '2037-01-19 03:14:07',
+ 'price_to' => '2038-01-19 03:14:07'
+ ]
+ ]
+ ]
+ );
+
+ $errorMessage = current(array_column($response, 'message'));
+ $this->assertStringContainsString(
+ 'Could not change non global Price when price scope is global.',
+ $errorMessage
+ );
+ }
+
/**
* Test delete method.
*
@@ -241,4 +300,60 @@ public function deleteData(): array
],
];
}
+
+ /**
+ * Test delete method for specific store.
+ *
+ * @magentoApiDataFixture Magento/Catalog/_files/product_two_websites.php
+ * @magentoConfigFixture default_store catalog/price/scope 1
+ * @return void
+ */
+ public function testDeleteDataForSpecificStore(): void
+ {
+ $secondStoreViewId = $this->storeManager->getStore('fixture_second_store')
+ ->getId();
+
+ $data = [
+ 'price' => 777,
+ 'store_id' => $secondStoreViewId,
+ 'sku' => self::PRODUCT_SKU_TWO_WEBSITES,
+ 'price_from' => '1970-01-01 00:00:01',
+ 'price_to' => false
+ ];
+
+ /** @var ProductRepositoryInterface $productRepository */
+ $productRepository = $this->objectManager->create(ProductRepositoryInterface::class);
+ $product = $productRepository->get($data['sku'], true, 1, true);
+ $product->setData('special_price', $data['price']);
+ $product->setData('special_from_date', $data['price_from']);
+
+ $this->productResource->saveAttribute($product, 'special_price');
+ $this->productResource->saveAttribute($product, 'special_from_date');
+ $this->productResource->saveAttribute($product, 'special_to_date');
+
+ $product->setData('store_id', $secondStoreViewId);
+ $this->productResource->saveAttribute($product, 'special_price');
+ $this->productResource->saveAttribute($product, 'special_from_date');
+ $this->productResource->saveAttribute($product, 'special_to_date');
+
+ $serviceInfo = [
+ 'rest' => [
+ 'resourcePath' => '/V1/products/special-price-delete',
+ 'httpMethod' => Request::HTTP_METHOD_POST
+ ],
+ 'soap' => [
+ 'service' => self::SERVICE_NAME,
+ 'serviceVersion' => self::SERVICE_VERSION,
+ 'operation' => self::SERVICE_NAME . 'Delete',
+ ],
+ ];
+
+ $this->_webApiCall($serviceInfo, ['prices' => [$data]]);
+
+ $product = $productRepository->get($data['sku'], false, 1, true);
+ $this->assertNotNull($product->getSpecialPrice());
+
+ $product = $productRepository->get($data['sku'], false, $secondStoreViewId, true);
+ $this->assertNull($product->getSpecialPrice());
+ }
}
diff --git a/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php b/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php
index 5197daa759e04..247a9ab34eb36 100644
--- a/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php
+++ b/dev/tests/integration/testsuite/Magento/Cms/Model/Page/DataProviderTest.php
@@ -9,11 +9,12 @@
namespace Magento\Cms\Model\Page;
use Magento\Cms\Api\GetPageByIdentifierInterface;
+use Magento\Framework\App\Request\Http as HttpRequest;
+use Magento\Framework\App\RequestInterface;
+use Magento\Framework\ObjectManagerInterface;
use Magento\TestFramework\Cms\Model\CustomLayoutManager;
use Magento\TestFramework\Helper\Bootstrap;
use PHPUnit\Framework\TestCase;
-use Magento\Cms\Model\Page as PageModel;
-use Magento\Framework\App\Request\Http as HttpRequest;
/**
* Test pages data provider.
@@ -22,6 +23,12 @@
*/
class DataProviderTest extends TestCase
{
+ private $providerData = [
+ 'name' => 'test',
+ 'primaryFieldName' => 'page_id',
+ 'requestFieldName' => 'page_id',
+ ];
+
/**
* @var DataProvider
*/
@@ -42,29 +49,26 @@ class DataProviderTest extends TestCase
*/
private $request;
+ /**
+ * @var ObjectManagerInterface
+ */
+ private $objectManager;
+
/**
* @inheritDoc
*/
protected function setUp(): void
{
- $objectManager = Bootstrap::getObjectManager();
- $objectManager->configure([
- 'preferences' => [
- \Magento\Cms\Model\Page\CustomLayoutManagerInterface::class =>
- \Magento\TestFramework\Cms\Model\CustomLayoutManager::class
- ]
+ $this->objectManager = Bootstrap::getObjectManager();
+ $this->objectManager->configure([
+ 'preferences' => [CustomLayoutManagerInterface::class => CustomLayoutManager::class]
]);
- $this->repo = $objectManager->get(GetPageByIdentifierInterface::class);
- $this->filesFaker = $objectManager->get(CustomLayoutManager::class);
- $this->request = $objectManager->get(HttpRequest::class);
- $this->provider = $objectManager->create(
+ $this->repo = $this->objectManager->get(GetPageByIdentifierInterface::class);
+ $this->filesFaker = $this->objectManager->get(CustomLayoutManager::class);
+ $this->request = $this->objectManager->get(HttpRequest::class);
+ $this->provider = $this->objectManager->create(
DataProvider::class,
- [
- 'name' => 'test',
- 'primaryFieldName' => 'page_id',
- 'requestFieldName' => 'page_id',
- 'customLayoutManager' => $this->filesFaker
- ]
+ array_merge($this->providerData, ['customLayoutManager' => $this->filesFaker])
);
}
@@ -72,29 +76,42 @@ protected function setUp(): void
* Check that custom layout date is handled properly.
*
* @magentoDataFixture Magento/Cms/_files/pages_with_layout_xml.php
- * @throws \Throwable
+ * @dataProvider customLayoutDataProvider
+ *
+ * @param string $identifier
+ * @param string|null $layoutUpdateSelected
* @return void
*/
- public function testCustomLayoutData(): void
+ public function testCustomLayoutData(string $identifier, ?string $layoutUpdateSelected): void
{
- $data = $this->provider->getData();
- $page1Data = null;
- $page2Data = null;
- $page3Data = null;
- foreach ($data as $pageData) {
- if ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_1') {
- $page1Data = $pageData;
- } elseif ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_2') {
- $page2Data = $pageData;
- } elseif ($pageData[PageModel::IDENTIFIER] === 'test_custom_layout_page_3') {
- $page3Data = $pageData;
- }
- }
- $this->assertNotEmpty($page1Data);
- $this->assertNotEmpty($page2Data);
- $this->assertEquals('_existing_', $page1Data['layout_update_selected']);
- $this->assertNull($page2Data['layout_update_selected']);
- $this->assertEquals('test_selected', $page3Data['layout_update_selected']);
+ $page = $this->repo->execute($identifier, 0);
+
+ $request = $this->objectManager->create(RequestInterface::class);
+ $request->setParam('page_id', $page->getId());
+
+ $provider = $this->objectManager->create(
+ DataProvider::class,
+ array_merge($this->providerData, ['request' => $request])
+ );
+
+ $data = $provider->getData();
+ $pageData = $data[$page->getId()];
+
+ $this->assertEquals($layoutUpdateSelected, $pageData['layout_update_selected']);
+ }
+
+ /**
+ * DataProvider for testCustomLayoutData
+ *
+ * @return array
+ */
+ public function customLayoutDataProvider(): array
+ {
+ return [
+ ['test_custom_layout_page_1', '_existing_'],
+ ['test_custom_layout_page_2', null],
+ ['test_custom_layout_page_3', 'test_selected'],
+ ];
}
/**
diff --git a/nginx.conf.sample b/nginx.conf.sample
index 2dbba68c39c39..989829c111210 100644
--- a/nginx.conf.sample
+++ b/nginx.conf.sample
@@ -108,8 +108,8 @@ location /static/ {
# expires max;
# Remove signature of the static files that is used to overcome the browser cache
- location ~ ^/static/version {
- rewrite ^/static/(version\d*/)?(.*)$ /static/$2 last;
+ location ~ ^/static/version\d*/ {
+ rewrite ^/static/version\d*/(.*)$ /static/$1 last;
}
location ~* \.(ico|jpg|jpeg|png|gif|svg|js|css|swf|eot|ttf|otf|woff|woff2|html|json)$ {